From 419509d9d28661ecb383dbc4fed85e80388e30c7 Mon Sep 17 00:00:00 2001 From: David Barri Date: Wed, 1 Jun 2022 10:09:44 +1000 Subject: [PATCH 01/72] Add `testEmissions` module with ReactRefresh JS test --- library/aliases.sbt | 28 ++-- library/build.sbt | 4 +- library/project/Build.scala | 54 +++++++- library/project/Dependencies.scala | 1 + library/project/Lib.scala | 20 ++- .../scalajs/react/test/emissions/Main.scala | 19 +++ .../jvm/src/test/node/.gitignore | 1 + .../jvm/src/test/node/babel.dev.json | 6 + .../jvm/src/test/node/babel.norm.json | 5 + .../jvm/src/test/node/package.json | 10 ++ .../jvm/src/test/resources/js/demo-in.js | 16 +++ .../jvm/src/test/resources/js/demo-out.js | 25 ++++ .../test/emissions/ReactRefreshTest.scala | 120 ++++++++++++++++++ .../react/test/emissions/util/Babel.scala | 79 ++++++++++++ .../react/test/emissions/util/Node.scala | 28 ++++ .../test/emissions/util/ProcessResult.scala | 47 +++++++ .../react/test/emissions/util/Props.scala | 27 ++++ .../react/test/emissions/util/Util.scala | 106 ++++++++++++++++ 18 files changed, 576 insertions(+), 20 deletions(-) create mode 100644 library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala create mode 100644 library/testEmissions/jvm/src/test/node/.gitignore create mode 100644 library/testEmissions/jvm/src/test/node/babel.dev.json create mode 100644 library/testEmissions/jvm/src/test/node/babel.norm.json create mode 100644 library/testEmissions/jvm/src/test/node/package.json create mode 100644 library/testEmissions/jvm/src/test/resources/js/demo-in.js create mode 100644 library/testEmissions/jvm/src/test/resources/js/demo-out.js create mode 100644 library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala create mode 100644 library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Babel.scala create mode 100644 library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Node.scala create mode 100644 library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/ProcessResult.scala create mode 100644 library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Props.scala create mode 100644 library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Util.scala diff --git a/library/aliases.sbt b/library/aliases.sbt index 6e4638d8c..8f88333fe 100644 --- a/library/aliases.sbt +++ b/library/aliases.sbt @@ -1,11 +1,17 @@ -addCommandAlias("CB", "project coreBundleCallback") -addCommandAlias("CE", "project coreBundleCatsEffect") -addCommandAlias("CG", "project coreGeneric") -addCommandAlias("E", "project extra") -addCommandAlias("FM", "project facadeMain") -addCommandAlias("FT", "project facadeTest") -addCommandAlias("GH", "project ghpages") -addCommandAlias("M2", "project extraExtMonocle2") -addCommandAlias("M3", "project extraExtMonocle3") -addCommandAlias("TS", "project tests") -addCommandAlias("TU", "project testUtil") +addCommandAlias("CB", "project coreBundleCallback") +addCommandAlias("CE", "project coreBundleCatsEffect") +addCommandAlias("CG", "project coreGeneric") +addCommandAlias("E", "project extra") +addCommandAlias("FM", "project facadeMain") +addCommandAlias("FT", "project facadeTest") +addCommandAlias("GH", "project ghpages") +addCommandAlias("M2", "project extraExtMonocle2") +addCommandAlias("M3", "project extraExtMonocle3") +addCommandAlias("TE", "project testEmissions") +addCommandAlias("TEJ", "project testEmissionsJS") +addCommandAlias("TT", "project tests") +addCommandAlias("TU", "project testUtil") + +addCommandAlias("tt", "tests/test") +addCommandAlias("te", "testEmissions/test") +addCommandAlias("cte", "testEmissionsJS/clean;testEmissions/test") diff --git a/library/build.sbt b/library/build.sbt index 51f48fd7f..414a15115 100644 --- a/library/build.sbt +++ b/library/build.sbt @@ -23,9 +23,11 @@ val ghpages = ScalaJsReact.ghpages val ghpagesMacros = ScalaJsReact.ghpagesMacros val root = ScalaJsReact.root val scalafixRules = ScalaJsReact.scalafixRules +val testEmissions = ScalaJsReact.testEmissions +val testEmissionsJS = ScalaJsReact.testEmissionsJS val tests = ScalaJsReact.tests -val testUtilMacros = ScalaJsReact.testUtilMacros val testUtil = ScalaJsReact.testUtil +val testUtilMacros = ScalaJsReact.testUtilMacros val util = ScalaJsReact.util val utilCatsEffect = ScalaJsReact.utilCatsEffect val utilDummyDefaults = ScalaJsReact.utilDummyDefaults diff --git a/library/project/Build.scala b/library/project/Build.scala index a82e36636..fcb65ebb1 100644 --- a/library/project/Build.scala +++ b/library/project/Build.scala @@ -1,6 +1,7 @@ import sbt._ import sbt.Keys._ import org.scalajs.jsdependencies.sbtplugin.JSDependenciesPlugin.autoImport._ +import org.scalajs.linker.interface.{ModuleInitializer, ModuleSplitStyle} import org.scalajs.sbtplugin.ScalaJSPlugin import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._ import scalafix.sbt.BuildInfo.{scalafixVersion => ScalafixVer} @@ -35,20 +36,25 @@ object ScalaJsReact { ghpages, ghpagesMacros, scalafixRules, + testEmissions, + testEmissionsJS, tests, - testUtilMacros, testUtil, + testUtilMacros, util, utilCatsEffect, utilDummyDefaults, utilFallbacks, ) - def commonSettings: PE = - _.enablePlugins(ScalaJSPlugin, ScalafixPlugin) + def commonSettingsCross: PE = + _.enablePlugins(ScalafixPlugin) .dependsOn(scalafixRules % ScalafixConfig) .configure(commonSettingsWithoutPlugins) + def commonSettings: PE = + _.enablePlugins(ScalaJSPlugin).configure(commonSettingsCross) + def shimDummyDefaults: PE = _.dependsOn(utilDummyDefaults % Provided) @@ -209,6 +215,48 @@ object ScalaJsReact { ) .configure(conditionallyDisable) // keep this last + lazy val testEmissions = project + .in(file("testEmissions/jvm")) + .configure(commonSettingsCross, preventPublication, utestSettingsCross) + .settings( + libraryDependencies += Dep.microlibsUtils.value, + Test / fork := true, + Test / javaOptions ++= { + val jsOutputDir = (testEmissionsJS / Compile / fastLinkJS / scalaJSLinkerOutputDirectory).value + val tempDir = (Test / classDirectory).value + val testResDir = (Test / resourceDirectory).value + val testRootDir = (Test / sourceDirectory).value + Seq( + s"-DjsOutputDir=${jsOutputDir.absolutePath}", + s"-DtempDir=${tempDir.absolutePath}", + s"-DtestResDir=${testResDir.absolutePath}", + s"-DtestRootDir=${testRootDir.absolutePath}", + ) + }, + Test / test := (Test / test ).dependsOn(testEmissionsJS / Compile / fastLinkJS).value, + Test / testOnly := (Test / testOnly).dependsOn(testEmissionsJS / Compile / fastLinkJS).evaluated, + ) + + lazy val testEmissionsJS = project + .in(file("testEmissions/js")) + .configure(commonSettings, preventPublication, hasNoTests) + .dependsOn(coreBundleCallback) + .settings( + Compile / scalaJSLinkerConfig ~= { _ + .withModuleKind(ModuleKind.ESModule) + .withModuleSplitStyle(ModuleSplitStyle.SmallestModules) + .withSourceMap(false) + // .withESFeatures(_.withESVersion(ESVersion.ES2021)) + // .withSemantics(_ + // .withArrayIndexOutOfBounds(CheckedBehavior.Unchecked) + // .withAsInstanceOfs(CheckedBehavior.Unchecked) + // .withProductionMode(true) + // ) + }, + Compile / scalaJSModuleInitializers += + ModuleInitializer.mainMethod("japgolly.scalajs.react.test.emissions.Main", "main") + ) + lazy val tests = project .dependsOn(testUtil, coreExtCatsEffect, extraExtMonocle3) .dependsOn(coreBundleCallback) // Low priority diff --git a/library/project/Dependencies.scala b/library/project/Dependencies.scala index 5d6710dbe..f9b268bd5 100644 --- a/library/project/Dependencies.scala +++ b/library/project/Dependencies.scala @@ -46,6 +46,7 @@ object Dependencies { val microlibsCompileTime = Def.setting("com.github.japgolly.microlibs" %%% "compile-time" % Ver.microlibs) val microlibsTestUtil = Def.setting("com.github.japgolly.microlibs" %%% "test-util" % Ver.microlibs) val microlibsTypes = Def.setting("com.github.japgolly.microlibs" %%% "types" % Ver.microlibs) + val microlibsUtils = Def.setting("com.github.japgolly.microlibs" %%% "utils" % Ver.microlibs) val monocle2 = Def.setting("com.github.julien-truffaut" %%% "monocle-core" % Ver.monocle2 cross CrossVersion.for3Use2_13 excludeAll(ExclusionRule(organization = "org.typelevel"))) val monocle3 = Def.setting("dev.optics" %%% "monocle-core" % Ver.monocle3) val nyayaGen = Def.setting("com.github.japgolly.nyaya" %%% "nyaya-gen" % Ver.nyaya) diff --git a/library/project/Lib.scala b/library/project/Lib.scala index 7f436c999..227dd23df 100644 --- a/library/project/Lib.scala +++ b/library/project/Lib.scala @@ -112,14 +112,24 @@ object Lib { def preventPublication: PE = _.settings(publish / skip := true) + def utestSettingsCross(scope: Configuration): PE = + _.settings( + scope / scalacOptions ++= { + val isScala2 = scalaVersion.value.startsWith("2") + if (isScala2) Seq("-Wconf:msg=copyArrayToImmutableIndexedSeq:s") else Seq() + }, + libraryDependencies += Dep.utest.value % scope, + libraryDependencies += Dep.microlibsTestUtil.value % scope, + testFrameworks += new TestFramework("utest.runner.Framework")) + + def utestSettingsCross: PE = + utestSettingsCross(Test) + def utestSettings(scope: Configuration): PE = - _.configure(InBrowserTesting.js) + _.configure(InBrowserTesting.js, utestSettingsCross(scope)) .settings( jsEnv := new JSDOMNodeJSEnv, - Test / scalacOptions += "-language:reflectiveCalls", - libraryDependencies += Dep.utest.value % scope, - libraryDependencies += Dep.microlibsTestUtil.value % scope, - testFrameworks += new TestFramework("utest.runner.Framework")) + Test / scalacOptions += "-language:reflectiveCalls") def utestSettings: PE = utestSettings(Test) diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala new file mode 100644 index 000000000..bf13cf687 --- /dev/null +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala @@ -0,0 +1,19 @@ +package japgolly.scalajs.react.test.emissions + +import japgolly.scalajs.react._ +import japgolly.scalajs.react.vdom.html_<^._ +import org.scalajs.dom + +object Main { + + def main(): Unit = { + val app = Component() + val cont = dom.document.getElementById("root") + app.renderIntoDOM(cont) + } + + private val Component = ScalaFnComponent[Unit] { _ => + <.div( + ) + } +} diff --git a/library/testEmissions/jvm/src/test/node/.gitignore b/library/testEmissions/jvm/src/test/node/.gitignore new file mode 100644 index 000000000..3c3629e64 --- /dev/null +++ b/library/testEmissions/jvm/src/test/node/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/library/testEmissions/jvm/src/test/node/babel.dev.json b/library/testEmissions/jvm/src/test/node/babel.dev.json new file mode 100644 index 000000000..91c5c13f8 --- /dev/null +++ b/library/testEmissions/jvm/src/test/node/babel.dev.json @@ -0,0 +1,6 @@ +{ + "presets": [], + "plugins": [ + "react-refresh/cjs/react-refresh-babel.development" + ] +} \ No newline at end of file diff --git a/library/testEmissions/jvm/src/test/node/babel.norm.json b/library/testEmissions/jvm/src/test/node/babel.norm.json new file mode 100644 index 000000000..c81d71a6a --- /dev/null +++ b/library/testEmissions/jvm/src/test/node/babel.norm.json @@ -0,0 +1,5 @@ +{ + "comments": false, + "presets": [], + "plugins": [] +} \ No newline at end of file diff --git a/library/testEmissions/jvm/src/test/node/package.json b/library/testEmissions/jvm/src/test/node/package.json new file mode 100644 index 000000000..8108400a5 --- /dev/null +++ b/library/testEmissions/jvm/src/test/node/package.json @@ -0,0 +1,10 @@ +{ + "name": "scalajs_react_testing", + "version": "1.0.0", + "private": true, + "dependencies": { + "@babel/cli": "^7.17.6", + "@babel/core": "^7.17.5", + "react-refresh": "^0.11.0" + } +} diff --git a/library/testEmissions/jvm/src/test/resources/js/demo-in.js b/library/testEmissions/jvm/src/test/resources/js/demo-in.js new file mode 100644 index 000000000..d7edeec10 --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/js/demo-in.js @@ -0,0 +1,16 @@ +import React, { useState, useEffect } from 'react' + +function App() { + const [count, setCount] = useState(0) + + useEffect(() => { + document.title = `You clicked ${count} times`; + }); + + return React.createElement("button", { + type: "button", + onClick: () => setCount(count => count + 1) + }, "count is: ", count); +} + +export default App diff --git a/library/testEmissions/jvm/src/test/resources/js/demo-out.js b/library/testEmissions/jvm/src/test/resources/js/demo-out.js new file mode 100644 index 000000000..77697c248 --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/js/demo-out.js @@ -0,0 +1,25 @@ +var _s = $RefreshSig$(); + +import React, { useState, useEffect } from 'react'; + +function App() { + _s(); + + const [count, setCount] = useState(0); + useEffect(() => { + document.title = `You clicked ${count} times`; + }); + return React.createElement("button", { + type: "button", + onClick: () => setCount(count => count + 1) + }, "count is: ", count); +} + +_s(App, "/xL7qdScToREtqzbt5GZ1kHtYjQ="); + +_c = App; +export default App; + +var _c; + +$RefreshReg$(_c, "App"); diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala new file mode 100644 index 000000000..f88b0ba23 --- /dev/null +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala @@ -0,0 +1,120 @@ +package japgolly.scalajs.react.test.emissions + +import japgolly.microlibs.testutil.TestUtil._ +import japgolly.microlibs.utils.FileUtils +import japgolly.scalajs.react.test.emissions.util._ +import utest._ +import utest.framework.TestPath + +object ReactRefreshTest extends TestSuite { + + override def tests = Tests { + + "js" - { + "demo" - testJs() + // "temp" - testJs() + } + + } + + // =================================================================================================================== + + protected def testJs()(implicit tp: TestPath) = { + val dir = "js" + val name = tp.value.last + val base = s"${Props.testResDir}/$dir/$name" + val inFilename = s"$base-in.js" + val expectFilename = s"$base-out.js" + val tempFilename = s"${Props.tempDir}/$dir-$name-in.js" + val babel = Babel.dev(inFilename, tempFilename) + + // For temp code, just show the output on screen + if (name.matches(""".*\bte?mp\b.*""")) { + Util.debugShowContent(s"$inFilename ", babel.after, "\u001b[106;30m") + () + } else + babel.rememberOrAssertOutput(expectFilename) + } + + // =================================================================================================================== + + protected def testScala(show : Boolean = false, + showBefore : Boolean = false, + expectRR : Boolean = true, + rememberOutput: Boolean = false, + )(expectedFrags: String*) + (implicit tp : TestPath) = { + + val pkg = "japgolly.scalajs.react.test.emissions" + val name = tp.value.last + val origFilename = s"${Props.jsOutputDir}/$pkg.$name" + "$.js" + val tempFilename = s"${Props.tempDir}/$name.js" + val expectFilename = s"${Props.testResDir}/sjs/$name-out.js" + var testOutcome = () : Any + + Babel.normaliseToFile(origFilename, tempFilename) + applyTempHacks(name, tempFilename) + val babel = Babel.dev(tempFilename) + + try { + babel.assertChanged() + babel.assertRR(expectRR) + babel.assertOutputContains(expectedFrags: _*) + + if (rememberOutput) + testOutcome = babel.rememberOrAssertOutput(expectFilename) + + if (testOutcome == () && expectRR) + testOutcome = + babel.after.replace('\n', ' ') match { + case rrSigHashRegex(h) => h + case _ => "Failed to find the RefreshSig state id" + } + + } finally { + if (showBefore) + Util.debugShowContent(s"$name.scala pre-babel js", babel.before, "\u001b[107;30m") + if (show) + Util.debugShowContent(s"$name.scala post-babel js", babel.after, "\u001b[107;30m") + } + + testOutcome + } + + private val rrSigHashRegex = """.*, ?"([a-zA-Z0-9/+]{27}=)"\);.*""".r + + protected def applyTempHacks(name: String, filename: String): Unit = { + locally(name) // avoid "unused" warning + + val before = Util.needFileContent(filename) + + var after = before + + // if (name startsWith "RewritePoC") + // after = after.replaceAll("""\(this\$\d+ => """, "").replaceAll("""\)\(this(?:\$\d+)?\)""", "") + + after = { + var allow = true + val exportPat = """^export \{ (\S+) \};?$""".r + after + .linesIterator + .filter(_ => allow) + .map { + case exportPat(name) => + allow = false + s"export default $name;" + // case s if !s.startsWith("import ") && s.contains("seState") => + // "/*↓*/\n" + s + case s => + s + } + .mkString("\n") + } + + if (before !=* after) { + FileUtils.write(filename, after) + // val after2 = Babel.normaliseToStr(filename) + // FileUtils.write(filename, after2) + } + } +} \ No newline at end of file diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Babel.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Babel.scala new file mode 100644 index 000000000..1318fe316 --- /dev/null +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Babel.scala @@ -0,0 +1,79 @@ +package japgolly.scalajs.react.test.emissions.util + +import japgolly.microlibs.testutil.TestUtil._ +import japgolly.microlibs.utils.FileUtils +import sourcecode.Line + +final case class Babel(before : String, + beforeFilename: String, + after : String) { + + def assertChanged()(implicit l: Line): Unit = + if (before ==* after) { + Util.debugShowContent(beforeFilename, before, "\u001b[43;30m") + fail("React Refresh Babel plugin didn't make any changes") + } + + def assertRR(expectInstalled: Boolean = true)(implicit l: Line): Unit = { + val actual = Util.countRR(after) + val expect = if (expectInstalled) 1 else 0 + if (actual !=* expect) { + showBadOutput() + assertEq("RR installations", actual, expect) + } + } + + def assertOutput(is: String)(implicit l: Line): Unit = + assertMultiline(actual = after, expect = is) + + def assertOutputContains(frags: String*)(implicit l: Line): Unit = + for (frag <- frags) + if (!after.contains(frag)) { + showBadOutput() + fail("Output doesn't contain: " + frag) + } + + private def showBadOutput(): Unit = + Util.debugShowContent(s"$beforeFilename ", after, "\u001b[43;30m") + + def rememberOrAssertOutput(filename: String)(implicit l: Line): Any = + Util.getFileContent(filename) match { + + // If no expectation file exists, create it + case None => + println(s"File not found, creating: $filename") + FileUtils.write(filename, after) + s"Created $filename" + + // Compare against expectation + case Some(e) => + assertOutput(e) + () + } +} + +object Babel { + + def dev(origFilename: String, tempFilename: String): Babel = { + normaliseToFile(origFilename, tempFilename) + dev(tempFilename) + } + + def dev(filename: String): Babel = { + val before = Util.needFileContent(filename) + val after = Node.babel(filename, "--config-file=./babel.dev.json") + Babel( + before = before, + beforeFilename = filename, + after = after, + ) + } + + private def useCfgNorm = "--config-file=./babel.norm.json" + + def normaliseToStr(srcFilename: String): String = + Node.babel(srcFilename, useCfgNorm) + + def normaliseToFile(srcFilename: String, tgtFilename: String): Unit = + Node.babel(srcFilename, useCfgNorm, "-o", tgtFilename) +} diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Node.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Node.scala new file mode 100644 index 000000000..f4a8b7bc7 --- /dev/null +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Node.scala @@ -0,0 +1,28 @@ +package japgolly.scalajs.react.test.emissions.util + +import java.io.File +import scala.sys.process.Process +import scala.util.Try + +object Node { + private val dir = new File(Props.testRootDir + "/node") + + private val init = Try { + val cmd = Seq("npm", "install", "--no-audit", "--no-fund") + println(cmd.mkString("\n> ", " ", "")) + + val code = Process(cmd, dir).! + println() + + if (code != 0) + throw new ExceptionInInitializerError(s"`${cmd.mkString(" ")}` exited with $code") + } + + def babel(args: String*): String = { + val _ = init + val cmd = Seq("./node_modules/.bin/babel") ++ args + val res = ProcessResult(cmd, dir) + res.assertExitStatus() + res.out + } +} diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/ProcessResult.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/ProcessResult.scala new file mode 100644 index 000000000..78ab83329 --- /dev/null +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/ProcessResult.scala @@ -0,0 +1,47 @@ +package japgolly.scalajs.react.test.emissions.util + +import java.io.File +import scala.sys.process._ + +final case class ProcessResult(cmd: Seq[String], exitStatus: Int, out: String, err: String) { + + def assertExitStatus(is: Int = 0): Unit = + if (exitStatus != is) { + System.out.println(out) + System.out.flush() + System.err.println(err) + System.err.flush() + throw new RuntimeException(s"`${cmd.mkString(" ")}` exited with $exitStatus") + } +} + +object ProcessResult { + + def apply(cmd: Seq[String], cwd: File): ProcessResult = { + val p = Process(cmd, cwd) + val output = new Output + val code = p ! output.catpure + ProcessResult(cmd, code, output.out.value(), output.err.value()) + } + + private final class Output { + val out = new OutputStream + val err = new OutputStream + def catpure = ProcessLogger(out.capture, err.capture) + } + + private final class OutputStream { + private var sb: java.lang.StringBuilder = null + + def capture: String => Unit = line => { + if (sb eq null) + sb = new java.lang.StringBuilder + else + sb.append('\n') + sb.append(line) + } + + def value(): String = + if (sb eq null) "" else sb.toString() + } +} diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Props.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Props.scala new file mode 100644 index 000000000..e92f19f7a --- /dev/null +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Props.scala @@ -0,0 +1,27 @@ +package japgolly.scalajs.react.test.emissions.util + +import scala.Console._ + +object Props { + + def moduleName = "testEmissions" + + private object Prop { + def get(property: String): Option[String] = { + val o = Option(System.getProperty(property)) + println(s"$CYAN[$moduleName] $property$RESET = $YELLOW${o.getOrElse("")}$RESET") + o + } + + def get(property: String, default: String): String = + get(property).getOrElse(default) + + def need(property: String): String = + get(property).getOrElse(throw new RuntimeException("Property not defined: " + property)) + } + + val jsOutputDir = Prop.need("jsOutputDir") + val tempDir = Prop.need("tempDir") + val testResDir = Prop.need("testResDir") + val testRootDir = Prop.need("testRootDir") +} diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Util.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Util.scala new file mode 100644 index 000000000..5f9d3ea8e --- /dev/null +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Util.scala @@ -0,0 +1,106 @@ +package japgolly.scalajs.react.test.emissions.util + +import japgolly.microlibs.utils.FileUtils +import java.io.{File, FileNotFoundException} +import java.nio.file.Files +import scala.annotation.tailrec +import scala.io.Source +import scala.sys.process._ +import scala.util.Try + +object Util { + + def containsRR(content: String): Boolean = + content.contains("$RefreshSig$") || content.contains("$RefreshReg$") + + def countRR(content: String): Int = + countSubstringOccurances(content, "$RefreshSig$()") + + def countSubstringOccurances(str: String, substr: String): Int = { + @tailrec + def go(s: String, n: Int): Int = { + val i = s.indexOf(substr) + if (i >= 0) + go(s.drop(i + substr.length), n + 1) + else + n + } + go(str, 0) + } + + def debugShowContent(name: String, content: String, colour: String): Unit = { + val batPath = "/usr/bin/bat" + var useBat = (new File(batPath)).exists() + val rr = containsRR(content) + val rrDesc = if (rr) "\u001b[102;30m[RR]" else "\u001b[101;97m[RR]" + val sep = "=" * (name.length + 5) + + val content2 = { + val sb = new java.lang.StringBuilder + val ignore = """^(?:['"]use strict|import ).*""".r + var showBlanks = false + var show = false + for (line <- content.trim.linesIterator) { + show = true + + if (line.trim.isEmpty) + show = showBlanks + else if (ignore.matches(line)) + show = false + + if (show) { + sb.append(line) + sb.append('\n') + showBlanks = true + } + } + sb.toString() + } + + println(sep) + println(rrDesc + Console.RESET + " " + colour + name + Console.RESET) + println(sep) + if (useBat) { + val f = writeToTempFile(".js")(content2) + val t = Try { Seq(batPath, "-pp", "--color=always", f).! } + if (!t.toOption.contains(0)) + useBat = false + } + if (!useBat) { + print(colour) + println(content2) + } + println(Console.RESET + sep) + println() + } + + def getFileContent(path: String): Option[String] = { + val f = new File(path) + Option.when(f.exists())(readSource(Source.fromFile(f))) + } + + def needFileContent(path: String): String = + readSource(Source.fromFile(new File(path))) + + def needResourceContent(path: String): String = { + getClass.getResourceAsStream(path) match { + case null => throw new FileNotFoundException("cp:" + path) + case is => try readSource(Source.fromInputStream(is)) finally is.close() + } + } + + private def readSource(src: => Source): String = { + val s = src + try s.mkString finally s.close() + } + + def writeToTempFile(fileSuffix: String)(content: String): String = { + val p = Files.createTempFile("sjr-emissions-", fileSuffix) + val f = p.toFile() + val d = f.getAbsolutePath() + FileUtils.write(d, content) + f.deleteOnExit() + d + } + +} From 67f0713d68906ab121b1415f1cb0db8110dc0271 Mon Sep 17 00:00:00 2001 From: David Barri Date: Wed, 1 Jun 2022 19:14:24 +1000 Subject: [PATCH 02/72] Add EmissionTest --- bin/ci | 1 + library/project/Build.scala | 1 + library/project/Lib.scala | 6 + .../scalajs/react/test/emissions/Main.scala | 1 + .../react/test/emissions/UseState.scala | 16 +++ .../test/resources/{js => rr-js}/demo-in.js | 0 .../test/resources/{js => rr-js}/demo-out.js | 0 .../src/test/resources/sjr/UseState-out.js | 37 ++++++ .../react/test/emissions/EmissionTest.scala | 80 +++++++++++ .../test/emissions/ReactRefreshTest.scala | 125 ++++++++---------- .../react/test/emissions/util/Babel.scala | 18 +-- .../emissions/util/MutableVirtualFile.scala | 105 +++++++++++++++ .../react/test/emissions/util/Node.scala | 2 +- .../react/test/emissions/util/Props.scala | 23 ++-- .../react/test/emissions/util/TestJs.scala | 22 +++ .../react/test/emissions/util/Util.scala | 16 +++ 16 files changed, 363 insertions(+), 90 deletions(-) create mode 100644 library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseState.scala rename library/testEmissions/jvm/src/test/resources/{js => rr-js}/demo-in.js (100%) rename library/testEmissions/jvm/src/test/resources/{js => rr-js}/demo-out.js (100%) create mode 100644 library/testEmissions/jvm/src/test/resources/sjr/UseState-out.js create mode 100644 library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/EmissionTest.scala create mode 100644 library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/MutableVirtualFile.scala create mode 100644 library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala diff --git a/bin/ci b/bin/ci index ca5b4f98f..5a3ea1b3b 100755 --- a/bin/ci +++ b/bin/ci @@ -40,6 +40,7 @@ echo rm -rf */target/scala-*/{,test-}classes cmd=( sbt + -DCI=1 -J-Xmx3G -J-XX:+UseG1GC ++$SCALA_VER diff --git a/library/project/Build.scala b/library/project/Build.scala index fcb65ebb1..4b71c97b8 100644 --- a/library/project/Build.scala +++ b/library/project/Build.scala @@ -227,6 +227,7 @@ object ScalaJsReact { val testResDir = (Test / resourceDirectory).value val testRootDir = (Test / sourceDirectory).value Seq( + s"-DCI=${if (inCI) "1" else "0"}", s"-DjsOutputDir=${jsOutputDir.absolutePath}", s"-DtempDir=${tempDir.absolutePath}", s"-DtestResDir=${testResDir.absolutePath}", diff --git a/library/project/Lib.scala b/library/project/Lib.scala index 227dd23df..45de9f7cf 100644 --- a/library/project/Lib.scala +++ b/library/project/Lib.scala @@ -14,6 +14,12 @@ object Lib { val ghProject = "scalajs-react" + private def readConfigVar(name: String): String = + Option(System.getProperty(name)).orElse(Option(System.getenv(name))) + .fold("")(_.trim.toLowerCase) + + val inCI = readConfigVar("CI") == "1" + def scalacCommonFlags: Seq[String] = Seq( "-deprecation", "-feature", diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala index bf13cf687..fe01e6602 100644 --- a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala @@ -14,6 +14,7 @@ object Main { private val Component = ScalaFnComponent[Unit] { _ => <.div( + UseState.Component(), ) } } diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseState.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseState.scala new file mode 100644 index 000000000..e685d6bd1 --- /dev/null +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseState.scala @@ -0,0 +1,16 @@ +package japgolly.scalajs.react.test.emissions + +import japgolly.scalajs.react._ +import japgolly.scalajs.react.vdom.html_<^._ + +object UseState { + + val Component = ScalaFnComponent.withHooks[Unit] + .useState(123) + .render { (_, s) => + <.button( + "Count is ", s.value, + ^.onClick --> s.modState(_ + 1), + ) + } +} diff --git a/library/testEmissions/jvm/src/test/resources/js/demo-in.js b/library/testEmissions/jvm/src/test/resources/rr-js/demo-in.js similarity index 100% rename from library/testEmissions/jvm/src/test/resources/js/demo-in.js rename to library/testEmissions/jvm/src/test/resources/rr-js/demo-in.js diff --git a/library/testEmissions/jvm/src/test/resources/js/demo-out.js b/library/testEmissions/jvm/src/test/resources/rr-js/demo-out.js similarity index 100% rename from library/testEmissions/jvm/src/test/resources/js/demo-out.js rename to library/testEmissions/jvm/src/test/resources/rr-js/demo-out.js diff --git a/library/testEmissions/jvm/src/test/resources/sjr/UseState-out.js b/library/testEmissions/jvm/src/test/resources/sjr/UseState-out.js new file mode 100644 index 000000000..663030fd2 --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/sjr/UseState-out.js @@ -0,0 +1,37 @@ +function $c_Lsjr_test_emissions_UseState$() { + this.Lsjr_test_emissions_UseState$__f_Component = null; + $n_Lsjr_test_emissions_UseState$ = this; + $j_sjr_package$.$m_Lsjr_package$(); + var this$4 = $j_sjr_hooks_HookComponentBuilder$.$m_Lsjr_hooks_HookComponentBuilder$().apply__Lsjr_hooks_HookComponentBuilder$ComponentP$First(); + var initialState = new $j_AnonFunction0.$c_sjsr_AnonFunction0((this$2 => () => 123)(this)); + var step = new $j_sjr_hooks_HookComponentBuilder$ComponentP$FirstStep.$c_Lsjr_hooks_HookComponentBuilder$ComponentP$FirstStep(); + var this$18 = $j_sjr_hooks_Api$SecondaryWithRender.$as_Lsjr_hooks_Api$SecondaryWithRender($j_sjr_hooks_Api$Primary.$f_Lsjr_hooks_Api$Primary__useState__F0__Lsjr_hooks_Api$AbstractStep__O(this$4, initialState, step)); + var f = new $j_AnonFunction2.$c_sjsr_AnonFunction2((this$2$1 => (x$1$2, s$2) => { + $j_java_lang_Object.$as_jl_Void(x$1$2); + var s = $j_sjr_hooks_Hooks$UseStateF.$as_Lsjr_hooks_Hooks$UseStateF(s$2); + var $$x2 = $j_sjr_vdom_HtmlTagOf$.$m_Lsjr_vdom_HtmlTagOf$(); + $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$(); + $j_sjr_vdom_Exports$.$m_Lsjr_vdom_Exports$(); + $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$(); + $j_sjr_vdom_VdomNode$.$m_Lsjr_vdom_VdomNode$(); + var $$x1 = new $j_sjr_vdom_VdomNode$$anon$1.$c_Lsjr_vdom_VdomNode$$anon$1("Count is "); + $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$(); + var v = $j_java_lang_Object.$uI(s.Lsjr_hooks_Hooks$UseStateF$$anon$2__f_raw[0]); + $j_sjr_vdom_VdomNode$.$m_Lsjr_vdom_VdomNode$(); + var array = [$$x1, new $j_sjr_vdom_VdomNode$$anon$1.$c_Lsjr_vdom_VdomNode$$anon$1(v), $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$().Lsjr_vdom_html_$__f_$up.Lsjr_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Lsjr_vdom_TagMod(new $j_AnonFunction0.$c_sjsr_AnonFunction0(((this$11, s$1) => () => { + $j_sjr_Reusable$.$m_Lsjr_Reusable$(); + var r = $j_sjr_hooks_Hooks$UseStateF.$f_Lsjr_hooks_Hooks$UseStateF__modState__Lsjr_Reusable(s$1); + return new $j_sjr_callback_CallbackTo.$c_Lsjr_callback_CallbackTo($j_sjr_callback_CallbackTo.$as_Lsjr_callback_CallbackTo($j_scala_Function1.$as_F1(r.value__O()).apply__O__O(new $j_scala_Function1.$c_sjsr_AnonFunction1((this$13 => x$2$2 => { + var x$2 = $j_java_lang_Object.$uI(x$2$2); + return 1 + x$2 | 0; + })(this$11)))).Lsjr_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline); + })(this$2$1, s)), $j_sjr_vdom_Attr$EventCallback$.$m_Lsjr_vdom_Attr$EventCallback$().Lsjr_vdom_Attr$EventCallback$__f_defaultSync)]; + return $$x2.apply$extension__T__sci_Seq__Lsjr_vdom_TagOf("button", new $j_WrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); + })(this)); + var this$17 = $j_sjr_hooks_HookComponentBuilder$ComponentP$SubsequentStep$.$m_Lsjr_hooks_HookComponentBuilder$ComponentP$SubsequentStep$(); + var step$1 = new $j_sjr_hooks_ComponentP_SubsequentSteps$$anon$1.$c_Lsjr_hooks_ComponentP_SubsequentSteps$$anon$1(this$17); + var s$3 = $j_sjr_CtorType$Summoner$.$m_Lsjr_CtorType$Summoner$().summonN__Lsjr_internal_Singleton__Lsjr_CtorType$Summoner($j_sjr_internal_Singleton$.$m_Lsjr_internal_Singleton$().Lsjr_internal_Singleton$__f_BoxUnit); + this.Lsjr_test_emissions_UseState$__f_Component = $j_sjr_hooks_Api$SecondaryWithRender.$f_Lsjr_hooks_Api$SecondaryWithRender__render__O__Lsjr_hooks_Api$SubsequentStep__Lsjr_CtorType$Summoner__Lsjr_component_JsBaseComponentTemplate$ComponentWithRoot(this$18, f, step$1, s$3); +} + +export { $c_Lsjr_test_emissions_UseState$ }; \ No newline at end of file diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/EmissionTest.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/EmissionTest.scala new file mode 100644 index 000000000..810ec9ef2 --- /dev/null +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/EmissionTest.scala @@ -0,0 +1,80 @@ +package japgolly.scalajs.react.test.emissions + +import japgolly.microlibs.testutil.TestUtil._ +import japgolly.scalajs.react.test.emissions.util._ +import utest._ +import utest.framework.TestPath + +object EmissionTest extends TestSuite { + + override def tests = Tests { + + "UseState" - testScala(hack = TestJs.Hack { _ + .dropLinesUntil(_ startsWith "function ") + .takeLinesTo(_ startsWith "export ") + }) + } + + // =================================================================================================================== + + /** Load scalajs-react output JS, and confirm the result. */ + protected def testScala(showResult : Boolean = false, + golden : Boolean = true, + normalise : Boolean = true, + hack : TestJs.Hack = null, + expectedFrags: Seq[String] = Seq.empty) + (implicit tp : TestPath) = { + + val pkg = Props.rootPkg + val name = tp.value.last + val actualFilename = s"${Props.jsOutputDir}/$pkg.$name" + "$.js" + val tempFilename = s"${Props.tempDir}/$name.js" + val expectFilename = s"${Props.testResDir}/${Props.resSubdirScala}/$name-out.js" + var utestOutput = () : Any + + val actual = { + + val filename = + if (normalise) { + Babel.normaliseToFile(actualFilename, tempFilename) + tempFilename + } else + actualFilename + + val js = new TestJs(name = name, filename = filename) + + // Make output much more readable, we're not testing the validity of SJS here + if (normalise) + js.modifyLines(_ + .replace("$0024", "$") + .replace("$002e", "_") // "." + .replace("$005f", "_") + .replace("$less$up", "") + .replace("japgolly_scalajs_react_", "sjr_") + .replaceAll("scala_scalajs_runtime_(?=AnonFunction|WrappedVarArgs)", "") + ) + + if (hack ne null) + hack.run(js) + + js.content + } + + try { + assertContainsAll(actual, expectedFrags: _*) + + if (golden) + Util.useOrCreateFile(expectFilename, actual, assertMultiline(actual, _)) match { + case None => utestOutput = s"Created $expectFilename" + case Some(_) => + } + + } finally { + if (showResult || !golden) + Util.debugShowContent(s"$name.scala JS", actual, "\u001b[107;30m") + } + + utestOutput + } + +} diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala index f88b0ba23..7b361a423 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala @@ -1,8 +1,8 @@ package japgolly.scalajs.react.test.emissions -import japgolly.microlibs.testutil.TestUtil._ import japgolly.microlibs.utils.FileUtils import japgolly.scalajs.react.test.emissions.util._ +import scala.util.Try import utest._ import utest.framework.TestPath @@ -14,13 +14,13 @@ object ReactRefreshTest extends TestSuite { "demo" - testJs() // "temp" - testJs() } - } // =================================================================================================================== + /** Load a JS file in /resources/, run ReactRefresh transforms over it, and confirm the result. */ protected def testJs()(implicit tp: TestPath) = { - val dir = "js" + val dir = Props.resSubdirJsRR val name = tp.value.last val base = s"${Props.testResDir}/$dir/$name" val inFilename = s"$base-in.js" @@ -33,88 +33,79 @@ object ReactRefreshTest extends TestSuite { Util.debugShowContent(s"$inFilename ", babel.after, "\u001b[106;30m") () } else - babel.rememberOrAssertOutput(expectFilename) + babel.assertOrSaveOutput(expectFilename) } - // =================================================================================================================== - - protected def testScala(show : Boolean = false, - showBefore : Boolean = false, - expectRR : Boolean = true, - rememberOutput: Boolean = false, - )(expectedFrags: String*) - (implicit tp : TestPath) = { - - val pkg = "japgolly.scalajs.react.test.emissions" + /** Load scalajs-react output JS, run ReactRefresh transforms over it, and confirm the result. */ + protected def testScala(assertRR : Boolean = true, + assertNoRR : Boolean = false, + assertBabelChanges: Boolean = true, + showResult : Boolean = false, + showPreBabel : Boolean = false, + golden : Boolean = true, + hack : TestJs.Hack = null, + expectedFrags : Seq[String] = Seq.empty) + (implicit tp : TestPath) = { + + val pkg = Props.rootPkg val name = tp.value.last - val origFilename = s"${Props.jsOutputDir}/$pkg.$name" + "$.js" + val actualFilename = s"${Props.jsOutputDir}/$pkg.$name" + "$.js" val tempFilename = s"${Props.tempDir}/$name.js" - val expectFilename = s"${Props.testResDir}/sjs/$name-out.js" - var testOutcome = () : Any + val expectFilename = s"${Props.testResDir}/${Props.resSubdirScalaRR}/$name-out.js" + var utestOutput = () : Any - Babel.normaliseToFile(origFilename, tempFilename) - applyTempHacks(name, tempFilename) - val babel = Babel.dev(tempFilename) + Babel.normaliseToFile(actualFilename, tempFilename) + + if (hack ne null) { + val js = new TestJs(name = name, filename = tempFilename) + hack.run(js) + if (js.changed()) + FileUtils.write(js.filename, js.content) + } + + val babel = + try + Babel.dev(tempFilename) + catch { + case t: Throwable => + Try { + val content = Util.needFileContent(tempFilename) + Util.debugShowContent(s"$name.scala JS pre-babel error", content, "\u001b[107;30m") + } + throw t + } try { - babel.assertChanged() - babel.assertRR(expectRR) + if (assertBabelChanges) + babel.assertChanged() + + if (assertRR) + babel.assertRR(true) + + if (assertNoRR) + babel.assertRR(false) + babel.assertOutputContains(expectedFrags: _*) - if (rememberOutput) - testOutcome = babel.rememberOrAssertOutput(expectFilename) + if (golden) + utestOutput = babel.assertOrSaveOutput(expectFilename) - if (testOutcome == () && expectRR) - testOutcome = + if (utestOutput == () && assertRR) + utestOutput = babel.after.replace('\n', ' ') match { case rrSigHashRegex(h) => h case _ => "Failed to find the RefreshSig state id" } } finally { - if (showBefore) - Util.debugShowContent(s"$name.scala pre-babel js", babel.before, "\u001b[107;30m") - if (show) - Util.debugShowContent(s"$name.scala post-babel js", babel.after, "\u001b[107;30m") + if (showPreBabel) + Util.debugShowContent(s"$name.scala JS pre-babel", babel.before, "\u001b[107;30m") + if (showResult) + Util.debugShowContent(s"$name.scala JS post-babel", babel.after, "\u001b[107;30m") } - testOutcome + utestOutput } private val rrSigHashRegex = """.*, ?"([a-zA-Z0-9/+]{27}=)"\);.*""".r - - protected def applyTempHacks(name: String, filename: String): Unit = { - locally(name) // avoid "unused" warning - - val before = Util.needFileContent(filename) - - var after = before - - // if (name startsWith "RewritePoC") - // after = after.replaceAll("""\(this\$\d+ => """, "").replaceAll("""\)\(this(?:\$\d+)?\)""", "") - - after = { - var allow = true - val exportPat = """^export \{ (\S+) \};?$""".r - after - .linesIterator - .filter(_ => allow) - .map { - case exportPat(name) => - allow = false - s"export default $name;" - // case s if !s.startsWith("import ") && s.contains("seState") => - // "/*↓*/\n" + s - case s => - s - } - .mkString("\n") - } - - if (before !=* after) { - FileUtils.write(filename, after) - // val after2 = Babel.normaliseToStr(filename) - // FileUtils.write(filename, after2) - } - } -} \ No newline at end of file +} diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Babel.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Babel.scala index 1318fe316..618f069c0 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Babel.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Babel.scala @@ -1,7 +1,6 @@ package japgolly.scalajs.react.test.emissions.util import japgolly.microlibs.testutil.TestUtil._ -import japgolly.microlibs.utils.FileUtils import sourcecode.Line final case class Babel(before : String, @@ -36,19 +35,10 @@ final case class Babel(before : String, private def showBadOutput(): Unit = Util.debugShowContent(s"$beforeFilename ", after, "\u001b[43;30m") - def rememberOrAssertOutput(filename: String)(implicit l: Line): Any = - Util.getFileContent(filename) match { - - // If no expectation file exists, create it - case None => - println(s"File not found, creating: $filename") - FileUtils.write(filename, after) - s"Created $filename" - - // Compare against expectation - case Some(e) => - assertOutput(e) - () + def assertOrSaveOutput(filename: String)(implicit l: Line): Any = + Util.useOrCreateFile(filename, after, assertOutput(_)) match { + case None => s"Created $filename" + case Some(_) => () } } diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/MutableVirtualFile.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/MutableVirtualFile.scala new file mode 100644 index 000000000..ebe54c6c2 --- /dev/null +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/MutableVirtualFile.scala @@ -0,0 +1,105 @@ +package japgolly.scalajs.react.test.emissions.util + +import japgolly.microlibs.utils.FileUtils +import japgolly.univeq._ +import java.util.regex.Pattern +import scala.util.matching.Regex + +class MutableVirtualFile(val filenameOption: Option[String], val originalContent: String) { + import MutableVirtualFile.StringFilterDsl + + var content = originalContent + + def changed(): Boolean = + content !=* originalContent + + def set(newContent: String): this.type = { + content = newContent + this + } + + def modify(f: String => String): this.type = + set(f(content)) + + def modifyLines(f: String => String): this.type = + modifyLinesIterator(_.map(f)) + + def modifyLinesIterator(f: Iterator[String] => Iterator[String]): this.type = + set(f(content.linesIterator).mkString("\n")) + + def +=(newLine: String): this.type = + set(content + "\n" + newLine) + + def dropLines(n: Int): this.type = + modifyLinesIterator(_.drop(n)) + + def dropLinesTo: StringFilterDsl[this.type] = + StringFilterDsl(f => modifyLinesIterator(_.dropWhile(f))) + + def dropLinesUntil: StringFilterDsl[this.type] = + StringFilterDsl(f => modifyLinesIterator(_.dropWhile(!f(_)))) + + def dropLinesWhile: StringFilterDsl[this.type] = + StringFilterDsl(f => modifyLinesIterator(_.dropWhile(f))) + + def filter: StringFilterDsl[this.type] = + StringFilterDsl(f => modifyLinesIterator(_.filter(f))) + + def filterNot: StringFilterDsl[this.type] = + StringFilterDsl(f => modifyLinesIterator(_.filterNot(f))) + + def takeLines(n: Int): this.type = + modifyLinesIterator(_.take(n)) + + def takeLinesTo: StringFilterDsl[this.type] = + StringFilterDsl(f => modifyLinesIterator(_.takeWhile(delayMatchBy1(f)))) + + def takeLinesUntil: StringFilterDsl[this.type] = + StringFilterDsl(f => modifyLinesIterator(_.takeWhile(!f(_)))) + + def takeLinesWhile: StringFilterDsl[this.type] = + StringFilterDsl(f => modifyLinesIterator(_.takeWhile(f))) + + private def delayMatchBy1[A](f: A => Boolean): A => Boolean = { + var allow = true + a => { + if (allow && f(a)) { + allow = false + true + } else + allow + } + } + + def reset(): Unit = + content = originalContent + + def trim(): Unit = + set(content.trim + "\n") +} + +object MutableVirtualFile { + + class FromFile(val filename: String, originalContent: String) extends MutableVirtualFile(Some(filename), originalContent) { + def this(filename: String) = + this(filename, Util.needFileContent(filename)) + + def writeFile(): Unit = + FileUtils.write(filename, content) + + def writeFileIfChanged(): Unit = + if (changed()) writeFile() + } + + final case class StringFilterDsl[A](private val run: (String => Boolean) => A) { + + def apply(f: String => Boolean): A = + run(f) + + def apply(r: Regex): A = + apply(r.pattern) + + def apply(p: Pattern): A = + apply(p.matcher(_).matches()) + } +} diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Node.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Node.scala index f4a8b7bc7..66cbc42a4 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Node.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Node.scala @@ -9,7 +9,7 @@ object Node { private val init = Try { val cmd = Seq("npm", "install", "--no-audit", "--no-fund") - println(cmd.mkString("\n> ", " ", "")) + print(cmd.mkString("> ", " ", "")) val code = Process(cmd, dir).! println() diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Props.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Props.scala index e92f19f7a..31fcd0116 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Props.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Props.scala @@ -1,12 +1,24 @@ package japgolly.scalajs.react.test.emissions.util -import scala.Console._ - object Props { - def moduleName = "testEmissions" + def rootPkg = "japgolly.scalajs.react.test.emissions" + def moduleName = "testEmissions" + def resSubdirJsRR = "rr-js" + def resSubdirScala = "sjr" + def resSubdirScalaRR = "rr-sjr" + + val CI = Prop.get("CI").contains("1") + val jsOutputDir = Prop.need("jsOutputDir") + val tempDir = Prop.need("tempDir") + val testResDir = Prop.need("testResDir") + val testRootDir = Prop.need("testRootDir") + + // ------------------------------------------------------------------------------------------------------------------- private object Prop { + import scala.Console._ + def get(property: String): Option[String] = { val o = Option(System.getProperty(property)) println(s"$CYAN[$moduleName] $property$RESET = $YELLOW${o.getOrElse("")}$RESET") @@ -19,9 +31,4 @@ object Props { def need(property: String): String = get(property).getOrElse(throw new RuntimeException("Property not defined: " + property)) } - - val jsOutputDir = Prop.need("jsOutputDir") - val tempDir = Prop.need("tempDir") - val testResDir = Prop.need("testResDir") - val testRootDir = Prop.need("testRootDir") } diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala new file mode 100644 index 000000000..a52412582 --- /dev/null +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala @@ -0,0 +1,22 @@ +package japgolly.scalajs.react.test.emissions.util + +// We're gonna inherit like it's 1999 baby! 🥳 +class TestJs(val name: String, val filename: String, originalContent: String) + extends MutableVirtualFile(Some(filename), originalContent) { + + def this(name: String, filename: String) = + this(name, filename, Util.needFileContent(filename)) + + trim() +} + +object TestJs { + + case class Hack(run: TestJs => Unit) { + def >> (next: Hack) : Hack = Hack { js => run(js); next.run(js) } + def when (b: Boolean) : Hack = when(_ => b) + def when (f: TestJs => Boolean): Hack = Hack { js => if (f(js)) run(js) } + def unless(b: Boolean) : Hack = unless(_ => b) + def unless(f: TestJs => Boolean): Hack = when(!f(_)) + } +} diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Util.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Util.scala index 5f9d3ea8e..f26d93be9 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Util.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Util.scala @@ -94,6 +94,22 @@ object Util { try s.mkString finally s.close() } + def useOrCreateFile[A](filename: String, create: => String, use: String => A): Option[A] = + getFileContent(filename) match { + + // If no file exists, create it + case None => + if (Props.CI) + throw new RuntimeException(s"File not found: $filename. This file should've been checked in to git.") + println(s"File not found, creating: $filename") + FileUtils.write(filename, create) + None + + // File exists + case Some(s) => + Some(use(s)) + } + def writeToTempFile(fileSuffix: String)(content: String): String = { val p = Files.createTempFile("sjr-emissions-", fileSuffix) val f = p.toFile() From f0e130f1ddfb01bcec456b5ba9ed50c625d54f63 Mon Sep 17 00:00:00 2001 From: David Barri Date: Wed, 1 Jun 2022 21:52:12 +1000 Subject: [PATCH 03/72] Update emissions for SJS 1.10 --- .../src/test/resources/sjr/UseState-out.js | 41 ++++++++++--------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/library/testEmissions/jvm/src/test/resources/sjr/UseState-out.js b/library/testEmissions/jvm/src/test/resources/sjr/UseState-out.js index 663030fd2..84a792dd2 100644 --- a/library/testEmissions/jvm/src/test/resources/sjr/UseState-out.js +++ b/library/testEmissions/jvm/src/test/resources/sjr/UseState-out.js @@ -3,35 +3,38 @@ function $c_Lsjr_test_emissions_UseState$() { $n_Lsjr_test_emissions_UseState$ = this; $j_sjr_package$.$m_Lsjr_package$(); var this$4 = $j_sjr_hooks_HookComponentBuilder$.$m_Lsjr_hooks_HookComponentBuilder$().apply__Lsjr_hooks_HookComponentBuilder$ComponentP$First(); - var initialState = new $j_AnonFunction0.$c_sjsr_AnonFunction0((this$2 => () => 123)(this)); + var initialState = new $j_AnonFunction0.$c_sjsr_AnonFunction0(() => 123); var step = new $j_sjr_hooks_HookComponentBuilder$ComponentP$FirstStep.$c_Lsjr_hooks_HookComponentBuilder$ComponentP$FirstStep(); - var this$18 = $j_sjr_hooks_Api$SecondaryWithRender.$as_Lsjr_hooks_Api$SecondaryWithRender($j_sjr_hooks_Api$Primary.$f_Lsjr_hooks_Api$Primary__useState__F0__Lsjr_hooks_Api$AbstractStep__O(this$4, initialState, step)); - var f = new $j_AnonFunction2.$c_sjsr_AnonFunction2((this$2$1 => (x$1$2, s$2) => { - $j_java_lang_Object.$as_jl_Void(x$1$2); - var s = $j_sjr_hooks_Hooks$UseStateF.$as_Lsjr_hooks_Hooks$UseStateF(s$2); - var $$x2 = $j_sjr_vdom_HtmlTagOf$.$m_Lsjr_vdom_HtmlTagOf$(); + var this$16 = $j_sjr_hooks_Api$SecondaryWithRender.$as_Lsjr_hooks_Api$SecondaryWithRender($j_sjr_hooks_Api$Primary.$f_Lsjr_hooks_Api$Primary__useState__F0__Lsjr_hooks_Api$AbstractStep__O(this$4, initialState, step)); + var f = new $j_AnonFunction2.$c_sjsr_AnonFunction2((_$1, s) => { + $j_java_lang_Object.$as_jl_Void(_$1); + var s$1 = $j_sjr_hooks_Hooks$UseStateF.$as_Lsjr_hooks_Hooks$UseStateF(s); + var this$14 = $j_sjr_vdom_HtmlTagOf$.$m_Lsjr_vdom_HtmlTagOf$(); $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$(); $j_sjr_vdom_Exports$.$m_Lsjr_vdom_Exports$(); + var self = "button"; + var $$x2 = $j_java_lang_Character$.$m_sr_ScalaRunTime$(); $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$(); $j_sjr_vdom_VdomNode$.$m_Lsjr_vdom_VdomNode$(); var $$x1 = new $j_sjr_vdom_VdomNode$$anon$1.$c_Lsjr_vdom_VdomNode$$anon$1("Count is "); $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$(); - var v = $j_java_lang_Object.$uI(s.Lsjr_hooks_Hooks$UseStateF$$anon$2__f_raw[0]); + var v = $j_java_lang_Object.$uI(s$1.Lsjr_hooks_Hooks$$anon$2__f_raw[0]); $j_sjr_vdom_VdomNode$.$m_Lsjr_vdom_VdomNode$(); - var array = [$$x1, new $j_sjr_vdom_VdomNode$$anon$1.$c_Lsjr_vdom_VdomNode$$anon$1(v), $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$().Lsjr_vdom_html_$__f_$up.Lsjr_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Lsjr_vdom_TagMod(new $j_AnonFunction0.$c_sjsr_AnonFunction0(((this$11, s$1) => () => { + var xs = $$x2.wrapRefArray__AO__sci_ArraySeq(new ($j_sjr_vdom_TagMod.$d_Lsjr_vdom_TagMod.getArrayOf().constr)([$$x1, new $j_sjr_vdom_VdomNode$$anon$1.$c_Lsjr_vdom_VdomNode$$anon$1(v), $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$().Lsjr_vdom_html_$__f_$up.Lsjr_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Lsjr_vdom_TagMod(new $j_AnonFunction0.$c_sjsr_AnonFunction0((s$2 => () => { $j_sjr_Reusable$.$m_Lsjr_Reusable$(); - var r = $j_sjr_hooks_Hooks$UseStateF.$f_Lsjr_hooks_Hooks$UseStateF__modState__Lsjr_Reusable(s$1); - return new $j_sjr_callback_CallbackTo.$c_Lsjr_callback_CallbackTo($j_sjr_callback_CallbackTo.$as_Lsjr_callback_CallbackTo($j_scala_Function1.$as_F1(r.value__O()).apply__O__O(new $j_scala_Function1.$c_sjsr_AnonFunction1((this$13 => x$2$2 => { - var x$2 = $j_java_lang_Object.$uI(x$2$2); - return 1 + x$2 | 0; - })(this$11)))).Lsjr_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline); - })(this$2$1, s)), $j_sjr_vdom_Attr$EventCallback$.$m_Lsjr_vdom_Attr$EventCallback$().Lsjr_vdom_Attr$EventCallback$__f_defaultSync)]; - return $$x2.apply$extension__T__sci_Seq__Lsjr_vdom_TagOf("button", new $j_WrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); - })(this)); - var this$17 = $j_sjr_hooks_HookComponentBuilder$ComponentP$SubsequentStep$.$m_Lsjr_hooks_HookComponentBuilder$ComponentP$SubsequentStep$(); - var step$1 = new $j_sjr_hooks_ComponentP_SubsequentSteps$$anon$1.$c_Lsjr_hooks_ComponentP_SubsequentSteps$$anon$1(this$17); + var r = $j_sjr_hooks_Hooks$UseStateF.$f_Lsjr_hooks_Hooks$UseStateF__modState__Lsjr_Reusable(s$2); + var ev$1 = $j_scala_Function1.$as_F1(r.value__O()).apply__O__O(new $j_scala_Function1.$c_sjsr_AnonFunction1(_$2 => { + var _$2$1 = $j_java_lang_Object.$uI(_$2); + + return 1 + _$2$1 | 0; + })); + return new $j_sjr_callback_CallbackTo.$c_Lsjr_callback_CallbackTo(ev$1 === null ? null : $j_sjr_callback_CallbackTo.$as_Lsjr_callback_CallbackTo(ev$1).Lsjr_callback_CallbackTo__f_trampoline); + })(s$1)), $j_sjr_vdom_Attr$EventCallback$.$m_Lsjr_vdom_Attr$EventCallback$().Lsjr_vdom_Attr$EventCallback$__f_defaultSync)])); + return $j_sjr_vdom_TagLite.$f_Lsjr_vdom_TagLite__apply__T__sci_Seq__Lsjr_vdom_TagOf(this$14, self, xs); + }); + var step$1 = new $j_sjr_hooks_ComponentP_SubsequentSteps$$anon$1.$c_Lsjr_hooks_ComponentP_SubsequentSteps$$anon$1(); var s$3 = $j_sjr_CtorType$Summoner$.$m_Lsjr_CtorType$Summoner$().summonN__Lsjr_internal_Singleton__Lsjr_CtorType$Summoner($j_sjr_internal_Singleton$.$m_Lsjr_internal_Singleton$().Lsjr_internal_Singleton$__f_BoxUnit); - this.Lsjr_test_emissions_UseState$__f_Component = $j_sjr_hooks_Api$SecondaryWithRender.$f_Lsjr_hooks_Api$SecondaryWithRender__render__O__Lsjr_hooks_Api$SubsequentStep__Lsjr_CtorType$Summoner__Lsjr_component_JsBaseComponentTemplate$ComponentWithRoot(this$18, f, step$1, s$3); + this.Lsjr_test_emissions_UseState$__f_Component = $j_sjr_hooks_Api$SecondaryWithRender.$f_Lsjr_hooks_Api$SecondaryWithRender__render__O__Lsjr_hooks_Api$SubsequentStep__Lsjr_CtorType$Summoner__Lsjr_component_JsBaseComponentTemplate$ComponentWithRoot(this$16, f, step$1, s$3); } export { $c_Lsjr_test_emissions_UseState$ }; \ No newline at end of file From 9f484dc81c01185b289c65bbcd398dd99058a99f Mon Sep 17 00:00:00 2001 From: David Barri Date: Thu, 2 Jun 2022 07:57:27 +1000 Subject: [PATCH 04/72] Separate emission expectations by Scala version --- library/project/Build.scala | 2 + .../src/test/resources/sjr/UseState-out2.js | 37 +++++++++++++++++++ .../sjr/{UseState-out.js => UseState-out3.js} | 0 .../react/test/emissions/EmissionTest.scala | 2 +- .../test/emissions/ReactRefreshTest.scala | 2 +- .../react/test/emissions/util/Props.scala | 3 ++ 6 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 library/testEmissions/jvm/src/test/resources/sjr/UseState-out2.js rename library/testEmissions/jvm/src/test/resources/sjr/{UseState-out.js => UseState-out3.js} (100%) diff --git a/library/project/Build.scala b/library/project/Build.scala index 169ae4902..572aa52c9 100644 --- a/library/project/Build.scala +++ b/library/project/Build.scala @@ -223,12 +223,14 @@ object ScalaJsReact { Test / fork := true, Test / javaOptions ++= { val jsOutputDir = (testEmissionsJS / Compile / fastLinkJS / scalaJSLinkerOutputDirectory).value + val scalaVer = scalaVersion.value val tempDir = (Test / classDirectory).value val testResDir = (Test / resourceDirectory).value val testRootDir = (Test / sourceDirectory).value Seq( s"-DCI=${if (inCI) "1" else "0"}", s"-DjsOutputDir=${jsOutputDir.absolutePath}", + s"-DscalaVer=$scalaVer", s"-DtempDir=${tempDir.absolutePath}", s"-DtestResDir=${testResDir.absolutePath}", s"-DtestRootDir=${testRootDir.absolutePath}", diff --git a/library/testEmissions/jvm/src/test/resources/sjr/UseState-out2.js b/library/testEmissions/jvm/src/test/resources/sjr/UseState-out2.js new file mode 100644 index 000000000..5d8e9c843 --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/sjr/UseState-out2.js @@ -0,0 +1,37 @@ +function $c_Lsjr_test_emissions_UseState$() { + this.Lsjr_test_emissions_UseState$__f_Component = null; + $n_Lsjr_test_emissions_UseState$ = this; + $j_sjr_package$.$m_Lsjr_package$(); + var this$4 = $j_sjr_hooks_HookComponentBuilder$.$m_Lsjr_hooks_HookComponentBuilder$().apply__Lsjr_hooks_HookComponentBuilder$ComponentP$First(); + var initialState = new $j_AnonFunction0.$c_sjsr_AnonFunction0(() => 123); + var step = new $j_sjr_hooks_HookComponentBuilder$ComponentP$FirstStep.$c_Lsjr_hooks_HookComponentBuilder$ComponentP$FirstStep(); + var this$18 = $j_sjr_hooks_Api$SecondaryWithRender.$as_Lsjr_hooks_Api$SecondaryWithRender($j_sjr_hooks_Api$Primary.$f_Lsjr_hooks_Api$Primary__useState__F0__Lsjr_hooks_Api$AbstractStep__O(this$4, initialState, step)); + var f = new $j_AnonFunction2.$c_sjsr_AnonFunction2((x$1$2, s$2) => { + $j_java_lang_Object.$as_jl_Void(x$1$2); + var s = $j_sjr_hooks_Hooks$UseStateF.$as_Lsjr_hooks_Hooks$UseStateF(s$2); + var $$x2 = $j_sjr_vdom_HtmlTagOf$.$m_Lsjr_vdom_HtmlTagOf$(); + $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$(); + $j_sjr_vdom_Exports$.$m_Lsjr_vdom_Exports$(); + $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$(); + $j_sjr_vdom_VdomNode$.$m_Lsjr_vdom_VdomNode$(); + var $$x1 = new $j_sjr_vdom_VdomNode$$anon$1.$c_Lsjr_vdom_VdomNode$$anon$1("Count is "); + $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$(); + var v = $j_java_lang_Object.$uI(s.Lsjr_hooks_Hooks$UseStateF$$anon$2__f_raw[0]); + $j_sjr_vdom_VdomNode$.$m_Lsjr_vdom_VdomNode$(); + var array = [$$x1, new $j_sjr_vdom_VdomNode$$anon$1.$c_Lsjr_vdom_VdomNode$$anon$1(v), $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$().Lsjr_vdom_html_$__f_$up.Lsjr_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Lsjr_vdom_TagMod(new $j_AnonFunction0.$c_sjsr_AnonFunction0((s$1 => () => { + $j_sjr_Reusable$.$m_Lsjr_Reusable$(); + var r = $j_sjr_hooks_Hooks$UseStateF.$f_Lsjr_hooks_Hooks$UseStateF__modState__Lsjr_Reusable(s$1); + return new $j_sjr_callback_CallbackTo.$c_Lsjr_callback_CallbackTo($j_sjr_callback_CallbackTo.$as_Lsjr_callback_CallbackTo($j_scala_Function1.$as_F1(r.value__O()).apply__O__O(new $j_scala_Function1.$c_sjsr_AnonFunction1(x$2$2 => { + var x$2 = $j_java_lang_Object.$uI(x$2$2); + return 1 + x$2 | 0; + }))).Lsjr_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline); + })(s)), $j_sjr_vdom_Attr$EventCallback$.$m_Lsjr_vdom_Attr$EventCallback$().Lsjr_vdom_Attr$EventCallback$__f_defaultSync)]; + return $$x2.apply$extension__T__sci_Seq__Lsjr_vdom_TagOf("button", new $j_WrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); + }); + var this$17 = $j_sjr_hooks_HookComponentBuilder$ComponentP$SubsequentStep$.$m_Lsjr_hooks_HookComponentBuilder$ComponentP$SubsequentStep$(); + var step$1 = new $j_sjr_hooks_ComponentP_SubsequentSteps$$anon$1.$c_Lsjr_hooks_ComponentP_SubsequentSteps$$anon$1(this$17); + var s$3 = $j_sjr_CtorType$Summoner$.$m_Lsjr_CtorType$Summoner$().summonN__Lsjr_internal_Singleton__Lsjr_CtorType$Summoner($j_sjr_internal_Singleton$.$m_Lsjr_internal_Singleton$().Lsjr_internal_Singleton$__f_BoxUnit); + this.Lsjr_test_emissions_UseState$__f_Component = $j_sjr_hooks_Api$SecondaryWithRender.$f_Lsjr_hooks_Api$SecondaryWithRender__render__O__Lsjr_hooks_Api$SubsequentStep__Lsjr_CtorType$Summoner__Lsjr_component_JsBaseComponentTemplate$ComponentWithRoot(this$18, f, step$1, s$3); +} + +export { $c_Lsjr_test_emissions_UseState$ }; \ No newline at end of file diff --git a/library/testEmissions/jvm/src/test/resources/sjr/UseState-out.js b/library/testEmissions/jvm/src/test/resources/sjr/UseState-out3.js similarity index 100% rename from library/testEmissions/jvm/src/test/resources/sjr/UseState-out.js rename to library/testEmissions/jvm/src/test/resources/sjr/UseState-out3.js diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/EmissionTest.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/EmissionTest.scala index 810ec9ef2..f82af37db 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/EmissionTest.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/EmissionTest.scala @@ -29,7 +29,7 @@ object EmissionTest extends TestSuite { val name = tp.value.last val actualFilename = s"${Props.jsOutputDir}/$pkg.$name" + "$.js" val tempFilename = s"${Props.tempDir}/$name.js" - val expectFilename = s"${Props.testResDir}/${Props.resSubdirScala}/$name-out.js" + val expectFilename = s"${Props.testResDir}/${Props.resSubdirScala}/$name-out${Props.scalaMajorVer}.js" var utestOutput = () : Any val actual = { diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala index 7b361a423..56fce15ea 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala @@ -51,7 +51,7 @@ object ReactRefreshTest extends TestSuite { val name = tp.value.last val actualFilename = s"${Props.jsOutputDir}/$pkg.$name" + "$.js" val tempFilename = s"${Props.tempDir}/$name.js" - val expectFilename = s"${Props.testResDir}/${Props.resSubdirScalaRR}/$name-out.js" + val expectFilename = s"${Props.testResDir}/${Props.resSubdirScalaRR}/$name-out${Props.scalaMajorVer}.js" var utestOutput = () : Any Babel.normaliseToFile(actualFilename, tempFilename) diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Props.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Props.scala index 31fcd0116..d5d358921 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Props.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Props.scala @@ -10,10 +10,13 @@ object Props { val CI = Prop.get("CI").contains("1") val jsOutputDir = Prop.need("jsOutputDir") + val scalaVer = Prop.need("scalaVer") val tempDir = Prop.need("tempDir") val testResDir = Prop.need("testResDir") val testRootDir = Prop.need("testRootDir") + val scalaMajorVer = scalaVer.takeWhile(_.isDigit).toInt + // ------------------------------------------------------------------------------------------------------------------- private object Prop { From 3d057f8ce6e11bd1b1ba8aff92ca3c6a3a73a1b0 Mon Sep 17 00:00:00 2001 From: David Barri Date: Thu, 2 Jun 2022 08:02:14 +1000 Subject: [PATCH 05/72] Emissions output: replace unicode "_", add trailing line --- .../jvm/src/test/resources/sjr/UseState-out2.js | 12 ++++++------ .../jvm/src/test/resources/sjr/UseState-out3.js | 12 ++++++------ .../scalajs/react/test/emissions/EmissionTest.scala | 1 + .../test/emissions/util/MutableVirtualFile.scala | 2 +- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/library/testEmissions/jvm/src/test/resources/sjr/UseState-out2.js b/library/testEmissions/jvm/src/test/resources/sjr/UseState-out2.js index 5d8e9c843..89f0c2b58 100644 --- a/library/testEmissions/jvm/src/test/resources/sjr/UseState-out2.js +++ b/library/testEmissions/jvm/src/test/resources/sjr/UseState-out2.js @@ -10,15 +10,15 @@ function $c_Lsjr_test_emissions_UseState$() { $j_java_lang_Object.$as_jl_Void(x$1$2); var s = $j_sjr_hooks_Hooks$UseStateF.$as_Lsjr_hooks_Hooks$UseStateF(s$2); var $$x2 = $j_sjr_vdom_HtmlTagOf$.$m_Lsjr_vdom_HtmlTagOf$(); - $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$(); + $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$(); $j_sjr_vdom_Exports$.$m_Lsjr_vdom_Exports$(); - $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$(); + $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$(); $j_sjr_vdom_VdomNode$.$m_Lsjr_vdom_VdomNode$(); var $$x1 = new $j_sjr_vdom_VdomNode$$anon$1.$c_Lsjr_vdom_VdomNode$$anon$1("Count is "); - $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$(); + $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$(); var v = $j_java_lang_Object.$uI(s.Lsjr_hooks_Hooks$UseStateF$$anon$2__f_raw[0]); $j_sjr_vdom_VdomNode$.$m_Lsjr_vdom_VdomNode$(); - var array = [$$x1, new $j_sjr_vdom_VdomNode$$anon$1.$c_Lsjr_vdom_VdomNode$$anon$1(v), $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$().Lsjr_vdom_html_$__f_$up.Lsjr_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Lsjr_vdom_TagMod(new $j_AnonFunction0.$c_sjsr_AnonFunction0((s$1 => () => { + var array = [$$x1, new $j_sjr_vdom_VdomNode$$anon$1.$c_Lsjr_vdom_VdomNode$$anon$1(v), $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$().Lsjr_vdom_html_$__f_$up.Lsjr_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Lsjr_vdom_TagMod(new $j_AnonFunction0.$c_sjsr_AnonFunction0((s$1 => () => { $j_sjr_Reusable$.$m_Lsjr_Reusable$(); var r = $j_sjr_hooks_Hooks$UseStateF.$f_Lsjr_hooks_Hooks$UseStateF__modState__Lsjr_Reusable(s$1); return new $j_sjr_callback_CallbackTo.$c_Lsjr_callback_CallbackTo($j_sjr_callback_CallbackTo.$as_Lsjr_callback_CallbackTo($j_scala_Function1.$as_F1(r.value__O()).apply__O__O(new $j_scala_Function1.$c_sjsr_AnonFunction1(x$2$2 => { @@ -29,9 +29,9 @@ function $c_Lsjr_test_emissions_UseState$() { return $$x2.apply$extension__T__sci_Seq__Lsjr_vdom_TagOf("button", new $j_WrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); }); var this$17 = $j_sjr_hooks_HookComponentBuilder$ComponentP$SubsequentStep$.$m_Lsjr_hooks_HookComponentBuilder$ComponentP$SubsequentStep$(); - var step$1 = new $j_sjr_hooks_ComponentP_SubsequentSteps$$anon$1.$c_Lsjr_hooks_ComponentP_SubsequentSteps$$anon$1(this$17); + var step$1 = new $j_sjr_hooks_ComponentP_SubsequentSteps$$anon$1.$c_Lsjr_hooks_ComponentP_SubsequentSteps$$anon$1(this$17); var s$3 = $j_sjr_CtorType$Summoner$.$m_Lsjr_CtorType$Summoner$().summonN__Lsjr_internal_Singleton__Lsjr_CtorType$Summoner($j_sjr_internal_Singleton$.$m_Lsjr_internal_Singleton$().Lsjr_internal_Singleton$__f_BoxUnit); this.Lsjr_test_emissions_UseState$__f_Component = $j_sjr_hooks_Api$SecondaryWithRender.$f_Lsjr_hooks_Api$SecondaryWithRender__render__O__Lsjr_hooks_Api$SubsequentStep__Lsjr_CtorType$Summoner__Lsjr_component_JsBaseComponentTemplate$ComponentWithRoot(this$18, f, step$1, s$3); } -export { $c_Lsjr_test_emissions_UseState$ }; \ No newline at end of file +export { $c_Lsjr_test_emissions_UseState$ }; diff --git a/library/testEmissions/jvm/src/test/resources/sjr/UseState-out3.js b/library/testEmissions/jvm/src/test/resources/sjr/UseState-out3.js index 84a792dd2..0ca7a224d 100644 --- a/library/testEmissions/jvm/src/test/resources/sjr/UseState-out3.js +++ b/library/testEmissions/jvm/src/test/resources/sjr/UseState-out3.js @@ -10,17 +10,17 @@ function $c_Lsjr_test_emissions_UseState$() { $j_java_lang_Object.$as_jl_Void(_$1); var s$1 = $j_sjr_hooks_Hooks$UseStateF.$as_Lsjr_hooks_Hooks$UseStateF(s); var this$14 = $j_sjr_vdom_HtmlTagOf$.$m_Lsjr_vdom_HtmlTagOf$(); - $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$(); + $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$(); $j_sjr_vdom_Exports$.$m_Lsjr_vdom_Exports$(); var self = "button"; var $$x2 = $j_java_lang_Character$.$m_sr_ScalaRunTime$(); - $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$(); + $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$(); $j_sjr_vdom_VdomNode$.$m_Lsjr_vdom_VdomNode$(); var $$x1 = new $j_sjr_vdom_VdomNode$$anon$1.$c_Lsjr_vdom_VdomNode$$anon$1("Count is "); - $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$(); + $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$(); var v = $j_java_lang_Object.$uI(s$1.Lsjr_hooks_Hooks$$anon$2__f_raw[0]); $j_sjr_vdom_VdomNode$.$m_Lsjr_vdom_VdomNode$(); - var xs = $$x2.wrapRefArray__AO__sci_ArraySeq(new ($j_sjr_vdom_TagMod.$d_Lsjr_vdom_TagMod.getArrayOf().constr)([$$x1, new $j_sjr_vdom_VdomNode$$anon$1.$c_Lsjr_vdom_VdomNode$$anon$1(v), $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$().Lsjr_vdom_html_$__f_$up.Lsjr_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Lsjr_vdom_TagMod(new $j_AnonFunction0.$c_sjsr_AnonFunction0((s$2 => () => { + var xs = $$x2.wrapRefArray__AO__sci_ArraySeq(new ($j_sjr_vdom_TagMod.$d_Lsjr_vdom_TagMod.getArrayOf().constr)([$$x1, new $j_sjr_vdom_VdomNode$$anon$1.$c_Lsjr_vdom_VdomNode$$anon$1(v), $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$().Lsjr_vdom_html_$__f_$up.Lsjr_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Lsjr_vdom_TagMod(new $j_AnonFunction0.$c_sjsr_AnonFunction0((s$2 => () => { $j_sjr_Reusable$.$m_Lsjr_Reusable$(); var r = $j_sjr_hooks_Hooks$UseStateF.$f_Lsjr_hooks_Hooks$UseStateF__modState__Lsjr_Reusable(s$2); var ev$1 = $j_scala_Function1.$as_F1(r.value__O()).apply__O__O(new $j_scala_Function1.$c_sjsr_AnonFunction1(_$2 => { @@ -32,9 +32,9 @@ function $c_Lsjr_test_emissions_UseState$() { })(s$1)), $j_sjr_vdom_Attr$EventCallback$.$m_Lsjr_vdom_Attr$EventCallback$().Lsjr_vdom_Attr$EventCallback$__f_defaultSync)])); return $j_sjr_vdom_TagLite.$f_Lsjr_vdom_TagLite__apply__T__sci_Seq__Lsjr_vdom_TagOf(this$14, self, xs); }); - var step$1 = new $j_sjr_hooks_ComponentP_SubsequentSteps$$anon$1.$c_Lsjr_hooks_ComponentP_SubsequentSteps$$anon$1(); + var step$1 = new $j_sjr_hooks_ComponentP_SubsequentSteps$$anon$1.$c_Lsjr_hooks_ComponentP_SubsequentSteps$$anon$1(); var s$3 = $j_sjr_CtorType$Summoner$.$m_Lsjr_CtorType$Summoner$().summonN__Lsjr_internal_Singleton__Lsjr_CtorType$Summoner($j_sjr_internal_Singleton$.$m_Lsjr_internal_Singleton$().Lsjr_internal_Singleton$__f_BoxUnit); this.Lsjr_test_emissions_UseState$__f_Component = $j_sjr_hooks_Api$SecondaryWithRender.$f_Lsjr_hooks_Api$SecondaryWithRender__render__O__Lsjr_hooks_Api$SubsequentStep__Lsjr_CtorType$Summoner__Lsjr_component_JsBaseComponentTemplate$ComponentWithRoot(this$16, f, step$1, s$3); } -export { $c_Lsjr_test_emissions_UseState$ }; \ No newline at end of file +export { $c_Lsjr_test_emissions_UseState$ }; diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/EmissionTest.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/EmissionTest.scala index f82af37db..65ca0d84e 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/EmissionTest.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/EmissionTest.scala @@ -46,6 +46,7 @@ object EmissionTest extends TestSuite { // Make output much more readable, we're not testing the validity of SJS here if (normalise) js.modifyLines(_ + .replace("_", "_") .replace("$0024", "$") .replace("$002e", "_") // "." .replace("$005f", "_") diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/MutableVirtualFile.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/MutableVirtualFile.scala index ebe54c6c2..e52ff3872 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/MutableVirtualFile.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/MutableVirtualFile.scala @@ -25,7 +25,7 @@ class MutableVirtualFile(val filenameOption: Option[String], val originalContent modifyLinesIterator(_.map(f)) def modifyLinesIterator(f: Iterator[String] => Iterator[String]): this.type = - set(f(content.linesIterator).mkString("\n")) + set(f(content.linesIterator).mkString("\n") + "\n") def +=(newLine: String): this.type = set(content + "\n" + newLine) From 5796d2ed23826e52dd0a0c6d1648679d58257230 Mon Sep 17 00:00:00 2001 From: David Barri Date: Thu, 2 Jun 2022 10:18:49 +1000 Subject: [PATCH 06/72] Tweak EmissionTest conditions to showResult --- .../japgolly/scalajs/react/test/emissions/EmissionTest.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/EmissionTest.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/EmissionTest.scala index 65ca0d84e..ce281c8a7 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/EmissionTest.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/EmissionTest.scala @@ -71,7 +71,8 @@ object EmissionTest extends TestSuite { } } finally { - if (showResult || !golden) + val didNothing = !golden && expectedFrags.isEmpty + if (showResult || didNothing) Util.debugShowContent(s"$name.scala JS", actual, "\u001b[107;30m") } From 1717979c57209c1d2eff9023063fe90e87bf6133 Mon Sep 17 00:00:00 2001 From: David Barri Date: Thu, 2 Jun 2022 10:29:44 +1000 Subject: [PATCH 07/72] Finally get working macros in place for a render hook method --- .../scalajs/react/hooks/HookMacros.scala | 54 ++++++++++++++++ .../scalajs/react/hooks/HookMacros.scala | 63 +++++++++++++++++++ .../japgolly/scalajs/react/hooks/Api.scala | 9 ++- .../src/test/resources/sjr/UseState-out2.js | 19 +++--- .../src/test/resources/sjr/UseState-out3.js | 59 ++++++++--------- 5 files changed, 161 insertions(+), 43 deletions(-) create mode 100644 library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala create mode 100644 library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala new file mode 100644 index 000000000..2bc3825f9 --- /dev/null +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -0,0 +1,54 @@ +package japgolly.scalajs.react.hooks + +import japgolly.microlibs.compiletime.MacroUtils +import japgolly.scalajs.react.{Children, CtorType} +import japgolly.scalajs.react.component.ScalaFn.Component +import japgolly.scalajs.react.hooks.Api._ +import japgolly.scalajs.react.internal.Box +import japgolly.scalajs.react.vdom.VdomNode +import scala.reflect.macros.blackbox.Context + +object HookMacros { + + trait ApiSecondaryWithRenderMacros[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] { + self: PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step] => + + final def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = + // Without macros: render(step.squash(f)(_)) + macro HookMacros.render[P, C, Ctx, CtxFn, Step] + } +} + +@annotation.nowarn("cat=unused") // TODO: remove +class HookMacros(val c: Context) extends MacroUtils { + import c.universe._ + + def render[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] + (f: c.Tree)(step: c.Tree, s: c.Tree): c.Tree = { + + var debug = false // showCode(c.macroApplication).contains("counter.value") + + def println(args: Any*): Unit = + if (debug) System.out.println(args.mkString) + + println("="*120) + println() + + val self = c.prefix + + val result = q""" + { + val f = $step.squash($f) + $self.render(f)($s) + } + """ + + if (debug) + println("RESULT:\n" + showCode(result)) + + println() + println("="*120) + + result + } +} diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala new file mode 100644 index 000000000..b210f52bc --- /dev/null +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala @@ -0,0 +1,63 @@ +package japgolly.scalajs.react.hooks + +import japgolly.microlibs.compiletime.MacroEnv._ +import japgolly.scalajs.react.{Children, CtorType} +import japgolly.scalajs.react.component.ScalaFn.Component +import japgolly.scalajs.react.hooks.Api._ +import japgolly.scalajs.react.internal.Box +import japgolly.scalajs.react.vdom.VdomNode +import scala.quoted.* +import scala.scalajs.js + +object HookMacros { + + trait ApiSecondaryWithRenderMacros[P, C <: Children, Ctx, CtxFn[_], _Step <: SubsequentStep[Ctx, CtxFn]] { + self: PrimaryWithRender[P, C, Ctx, _Step] with Secondary[Ctx, CtxFn, _Step] => + + inline final def render(inline f: CtxFn[VdomNode])(implicit inline step: Step, inline s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = + // Without macros: render(step.squash(f)(_)) + renderWorkaround[P, C, Ctx, CtxFn, Step, s.CT](this, f, step, s) + } + + // =================================================================================================================== + + // https://github.com/lampepfl/dotty/issues/15357 + inline def renderWorkaround[ + P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u] + ](inline self: PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step], + inline f : CtxFn[VdomNode], + inline step : Step, + inline s : CtorType.Summoner.Aux[Box[P], C, CT], + ): Component[P, CT] = + ${ renderMacro[P, C, Ctx, CtxFn, Step, CT]('self, 'f, 'step, 's) } + + def renderMacro[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]] + (self: Expr[PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step]], + f : Expr[CtxFn[VdomNode]], + step : Expr[Step], + s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], + )(using Quotes, Type[P], Type[C], Type[CT], Type[Ctx], Type[CtxFn], Type[Step]): Expr[Component[P, CT]] = { + + import quotes.reflect.* + + var debug = false // showCode(c.macroApplication).contains("counter.value") + + def println(args: Any*): Unit = + if (debug) System.out.println(args.mkString) + + println("="*120) + println() + + val result: Expr[Component[P, CT]] = + '{ $self.render($step.squash($f)(_))($s) } + + if (debug) + println("RESULT:\n" + result.show) + + println() + println("="*120) + + result + } + +} diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Api.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Api.scala index f905850f2..3e2eebbc8 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Api.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Api.scala @@ -690,9 +690,12 @@ object Api { def renderWithReuseBy[A](reusableInputs: Ctx => A)(f: A => VdomNode)(implicit s: CtorType.Summoner[Box[P], C], r: Reusability[A]): Component[P, s.CT] } - trait SecondaryWithRender[P, C <: Children, Ctx, CtxFn[_], _Step <: SubsequentStep[Ctx, CtxFn]] extends PrimaryWithRender[P, C, Ctx, _Step] with Secondary[Ctx, CtxFn, _Step] { - final def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = - render(step.squash(f)(_)) + trait SecondaryWithRender[P, C <: Children, Ctx, CtxFn[_], _Step <: SubsequentStep[Ctx, CtxFn]] extends PrimaryWithRender[P, C, Ctx, _Step] with Secondary[Ctx, CtxFn, _Step] with HookMacros.ApiSecondaryWithRenderMacros[P, C, Ctx, CtxFn, _Step] { + + // This has been moved into HookMacros.ApiSecondaryWithRenderMacros + // + // final def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = + // render(step.squash(f)(_)) final def renderReusable[A](f: CtxFn[Reusable[A]])(implicit step: Step, s: CtorType.Summoner[Box[P], C], v: A => VdomNode): Component[P, s.CT] = renderReusable(step.squash(f)(_)) diff --git a/library/testEmissions/jvm/src/test/resources/sjr/UseState-out2.js b/library/testEmissions/jvm/src/test/resources/sjr/UseState-out2.js index 89f0c2b58..ee7418a90 100644 --- a/library/testEmissions/jvm/src/test/resources/sjr/UseState-out2.js +++ b/library/testEmissions/jvm/src/test/resources/sjr/UseState-out2.js @@ -1,12 +1,8 @@ function $c_Lsjr_test_emissions_UseState$() { this.Lsjr_test_emissions_UseState$__f_Component = null; $n_Lsjr_test_emissions_UseState$ = this; - $j_sjr_package$.$m_Lsjr_package$(); - var this$4 = $j_sjr_hooks_HookComponentBuilder$.$m_Lsjr_hooks_HookComponentBuilder$().apply__Lsjr_hooks_HookComponentBuilder$ComponentP$First(); - var initialState = new $j_AnonFunction0.$c_sjsr_AnonFunction0(() => 123); - var step = new $j_sjr_hooks_HookComponentBuilder$ComponentP$FirstStep.$c_Lsjr_hooks_HookComponentBuilder$ComponentP$FirstStep(); - var this$18 = $j_sjr_hooks_Api$SecondaryWithRender.$as_Lsjr_hooks_Api$SecondaryWithRender($j_sjr_hooks_Api$Primary.$f_Lsjr_hooks_Api$Primary__useState__F0__Lsjr_hooks_Api$AbstractStep__O(this$4, initialState, step)); - var f = new $j_AnonFunction2.$c_sjsr_AnonFunction2((x$1$2, s$2) => { + var this$1 = $j_sjr_hooks_HookComponentBuilder$ComponentP$SubsequentStep$.$m_Lsjr_hooks_HookComponentBuilder$ComponentP$SubsequentStep$(); + var f = $j_scala_Function1.$as_F1(new $j_sjr_hooks_ComponentP_SubsequentSteps$$anon$1.$c_Lsjr_hooks_ComponentP_SubsequentSteps$$anon$1(this$1).squash__F1().apply__O__O(new $j_AnonFunction2.$c_sjsr_AnonFunction2((x$1$2, s$2) => { $j_java_lang_Object.$as_jl_Void(x$1$2); var s = $j_sjr_hooks_Hooks$UseStateF.$as_Lsjr_hooks_Hooks$UseStateF(s$2); var $$x2 = $j_sjr_vdom_HtmlTagOf$.$m_Lsjr_vdom_HtmlTagOf$(); @@ -27,11 +23,12 @@ function $c_Lsjr_test_emissions_UseState$() { }))).Lsjr_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline); })(s)), $j_sjr_vdom_Attr$EventCallback$.$m_Lsjr_vdom_Attr$EventCallback$().Lsjr_vdom_Attr$EventCallback$__f_defaultSync)]; return $$x2.apply$extension__T__sci_Seq__Lsjr_vdom_TagOf("button", new $j_WrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); - }); - var this$17 = $j_sjr_hooks_HookComponentBuilder$ComponentP$SubsequentStep$.$m_Lsjr_hooks_HookComponentBuilder$ComponentP$SubsequentStep$(); - var step$1 = new $j_sjr_hooks_ComponentP_SubsequentSteps$$anon$1.$c_Lsjr_hooks_ComponentP_SubsequentSteps$$anon$1(this$17); - var s$3 = $j_sjr_CtorType$Summoner$.$m_Lsjr_CtorType$Summoner$().summonN__Lsjr_internal_Singleton__Lsjr_CtorType$Summoner($j_sjr_internal_Singleton$.$m_Lsjr_internal_Singleton$().Lsjr_internal_Singleton$__f_BoxUnit); - this.Lsjr_test_emissions_UseState$__f_Component = $j_sjr_hooks_Api$SecondaryWithRender.$f_Lsjr_hooks_Api$SecondaryWithRender__render__O__Lsjr_hooks_Api$SubsequentStep__Lsjr_CtorType$Summoner__Lsjr_component_JsBaseComponentTemplate$ComponentWithRoot(this$18, f, step$1, s$3); + }))); + $j_sjr_package$.$m_Lsjr_package$(); + var this$17 = $j_sjr_hooks_HookComponentBuilder$.$m_Lsjr_hooks_HookComponentBuilder$().apply__Lsjr_hooks_HookComponentBuilder$ComponentP$First(); + var initialState = new $j_AnonFunction0.$c_sjsr_AnonFunction0(() => 123); + var step = new $j_sjr_hooks_HookComponentBuilder$ComponentP$FirstStep.$c_Lsjr_hooks_HookComponentBuilder$ComponentP$FirstStep(); + this.Lsjr_test_emissions_UseState$__f_Component = $j_sjr_hooks_HookComponentBuilder$ComponentP$Subsequent.$as_Lsjr_hooks_HookComponentBuilder$ComponentP$Subsequent($j_sjr_hooks_Api$Primary.$f_Lsjr_hooks_Api$Primary__useState__F0__Lsjr_hooks_Api$AbstractStep__O(this$17, initialState, step)).render__F1__Lsjr_CtorType$Summoner__Lsjr_component_JsBaseComponentTemplate$ComponentWithRoot(f, $j_sjr_CtorType$Summoner$.$m_Lsjr_CtorType$Summoner$().summonN__Lsjr_internal_Singleton__Lsjr_CtorType$Summoner($j_sjr_internal_Singleton$.$m_Lsjr_internal_Singleton$().Lsjr_internal_Singleton$__f_BoxUnit)); } export { $c_Lsjr_test_emissions_UseState$ }; diff --git a/library/testEmissions/jvm/src/test/resources/sjr/UseState-out3.js b/library/testEmissions/jvm/src/test/resources/sjr/UseState-out3.js index 0ca7a224d..a927166f4 100644 --- a/library/testEmissions/jvm/src/test/resources/sjr/UseState-out3.js +++ b/library/testEmissions/jvm/src/test/resources/sjr/UseState-out3.js @@ -5,36 +5,37 @@ function $c_Lsjr_test_emissions_UseState$() { var this$4 = $j_sjr_hooks_HookComponentBuilder$.$m_Lsjr_hooks_HookComponentBuilder$().apply__Lsjr_hooks_HookComponentBuilder$ComponentP$First(); var initialState = new $j_AnonFunction0.$c_sjsr_AnonFunction0(() => 123); var step = new $j_sjr_hooks_HookComponentBuilder$ComponentP$FirstStep.$c_Lsjr_hooks_HookComponentBuilder$ComponentP$FirstStep(); - var this$16 = $j_sjr_hooks_Api$SecondaryWithRender.$as_Lsjr_hooks_Api$SecondaryWithRender($j_sjr_hooks_Api$Primary.$f_Lsjr_hooks_Api$Primary__useState__F0__Lsjr_hooks_Api$AbstractStep__O(this$4, initialState, step)); - var f = new $j_AnonFunction2.$c_sjsr_AnonFunction2((_$1, s) => { - $j_java_lang_Object.$as_jl_Void(_$1); - var s$1 = $j_sjr_hooks_Hooks$UseStateF.$as_Lsjr_hooks_Hooks$UseStateF(s); - var this$14 = $j_sjr_vdom_HtmlTagOf$.$m_Lsjr_vdom_HtmlTagOf$(); - $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$(); - $j_sjr_vdom_Exports$.$m_Lsjr_vdom_Exports$(); - var self = "button"; - var $$x2 = $j_java_lang_Character$.$m_sr_ScalaRunTime$(); - $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$(); - $j_sjr_vdom_VdomNode$.$m_Lsjr_vdom_VdomNode$(); - var $$x1 = new $j_sjr_vdom_VdomNode$$anon$1.$c_Lsjr_vdom_VdomNode$$anon$1("Count is "); - $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$(); - var v = $j_java_lang_Object.$uI(s$1.Lsjr_hooks_Hooks$$anon$2__f_raw[0]); - $j_sjr_vdom_VdomNode$.$m_Lsjr_vdom_VdomNode$(); - var xs = $$x2.wrapRefArray__AO__sci_ArraySeq(new ($j_sjr_vdom_TagMod.$d_Lsjr_vdom_TagMod.getArrayOf().constr)([$$x1, new $j_sjr_vdom_VdomNode$$anon$1.$c_Lsjr_vdom_VdomNode$$anon$1(v), $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$().Lsjr_vdom_html_$__f_$up.Lsjr_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Lsjr_vdom_TagMod(new $j_AnonFunction0.$c_sjsr_AnonFunction0((s$2 => () => { - $j_sjr_Reusable$.$m_Lsjr_Reusable$(); - var r = $j_sjr_hooks_Hooks$UseStateF.$f_Lsjr_hooks_Hooks$UseStateF__modState__Lsjr_Reusable(s$2); - var ev$1 = $j_scala_Function1.$as_F1(r.value__O()).apply__O__O(new $j_scala_Function1.$c_sjsr_AnonFunction1(_$2 => { - var _$2$1 = $j_java_lang_Object.$uI(_$2); + var ApiSecondaryWithRenderMacros_this = $j_sjr_hooks_HookComponentBuilder$ComponentP$Subsequent.$as_Lsjr_hooks_HookComponentBuilder$ComponentP$Subsequent($j_sjr_hooks_Api$Primary.$f_Lsjr_hooks_Api$Primary__useState__F0__Lsjr_hooks_Api$AbstractStep__O(this$4, initialState, step)); + this.Lsjr_test_emissions_UseState$__f_Component = ApiSecondaryWithRenderMacros_this.render__F1__Lsjr_CtorType$Summoner__Lsjr_component_JsBaseComponentTemplate$ComponentWithRoot(new $j_scala_Function1.$c_sjsr_AnonFunction1(_$4 => { + var _$4$1 = $j_sjr_hooks_HookCtx$P1.$as_Lsjr_hooks_HookCtx$P1(_$4); - return 1 + _$2$1 | 0; - })); - return new $j_sjr_callback_CallbackTo.$c_Lsjr_callback_CallbackTo(ev$1 === null ? null : $j_sjr_callback_CallbackTo.$as_Lsjr_callback_CallbackTo(ev$1).Lsjr_callback_CallbackTo__f_trampoline); - })(s$1)), $j_sjr_vdom_Attr$EventCallback$.$m_Lsjr_vdom_Attr$EventCallback$().Lsjr_vdom_Attr$EventCallback$__f_defaultSync)])); - return $j_sjr_vdom_TagLite.$f_Lsjr_vdom_TagLite__apply__T__sci_Seq__Lsjr_vdom_TagOf(this$14, self, xs); - }); - var step$1 = new $j_sjr_hooks_ComponentP_SubsequentSteps$$anon$1.$c_Lsjr_hooks_ComponentP_SubsequentSteps$$anon$1(); - var s$3 = $j_sjr_CtorType$Summoner$.$m_Lsjr_CtorType$Summoner$().summonN__Lsjr_internal_Singleton__Lsjr_CtorType$Summoner($j_sjr_internal_Singleton$.$m_Lsjr_internal_Singleton$().Lsjr_internal_Singleton$__f_BoxUnit); - this.Lsjr_test_emissions_UseState$__f_Component = $j_sjr_hooks_Api$SecondaryWithRender.$f_Lsjr_hooks_Api$SecondaryWithRender__render__O__Lsjr_hooks_Api$SubsequentStep__Lsjr_CtorType$Summoner__Lsjr_component_JsBaseComponentTemplate$ComponentWithRoot(this$16, f, step$1, s$3); + return $j_sjr_vdom_VdomNode.$as_Lsjr_vdom_VdomNode($j_scala_Function1.$as_F1(new $j_sjr_hooks_ComponentP_SubsequentSteps$$anon$1.$c_Lsjr_hooks_ComponentP_SubsequentSteps$$anon$1().squash__F1().apply__O__O(new $j_AnonFunction2.$c_sjsr_AnonFunction2((_$1, s) => { + $j_java_lang_Object.$as_jl_Void(_$1); + var s$1 = $j_sjr_hooks_Hooks$UseStateF.$as_Lsjr_hooks_Hooks$UseStateF(s); + var this$16 = $j_sjr_vdom_HtmlTagOf$.$m_Lsjr_vdom_HtmlTagOf$(); + $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$(); + $j_sjr_vdom_Exports$.$m_Lsjr_vdom_Exports$(); + var self = "button"; + var $$x2 = $j_java_lang_Character$.$m_sr_ScalaRunTime$(); + $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$(); + $j_sjr_vdom_VdomNode$.$m_Lsjr_vdom_VdomNode$(); + var $$x1 = new $j_sjr_vdom_VdomNode$$anon$1.$c_Lsjr_vdom_VdomNode$$anon$1("Count is "); + $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$(); + var v = $j_java_lang_Object.$uI(s$1.Lsjr_hooks_Hooks$$anon$2__f_raw[0]); + $j_sjr_vdom_VdomNode$.$m_Lsjr_vdom_VdomNode$(); + var xs = $$x2.wrapRefArray__AO__sci_ArraySeq(new ($j_sjr_vdom_TagMod.$d_Lsjr_vdom_TagMod.getArrayOf().constr)([$$x1, new $j_sjr_vdom_VdomNode$$anon$1.$c_Lsjr_vdom_VdomNode$$anon$1(v), $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$().Lsjr_vdom_html_$__f_$up.Lsjr_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Lsjr_vdom_TagMod(new $j_AnonFunction0.$c_sjsr_AnonFunction0((s$2 => () => { + $j_sjr_Reusable$.$m_Lsjr_Reusable$(); + var r = $j_sjr_hooks_Hooks$UseStateF.$f_Lsjr_hooks_Hooks$UseStateF__modState__Lsjr_Reusable(s$2); + var ev$1 = $j_scala_Function1.$as_F1(r.value__O()).apply__O__O(new $j_scala_Function1.$c_sjsr_AnonFunction1(_$2 => { + var _$2$1 = $j_java_lang_Object.$uI(_$2); + + return 1 + _$2$1 | 0; + })); + return new $j_sjr_callback_CallbackTo.$c_Lsjr_callback_CallbackTo(ev$1 === null ? null : $j_sjr_callback_CallbackTo.$as_Lsjr_callback_CallbackTo(ev$1).Lsjr_callback_CallbackTo__f_trampoline); + })(s$1)), $j_sjr_vdom_Attr$EventCallback$.$m_Lsjr_vdom_Attr$EventCallback$().Lsjr_vdom_Attr$EventCallback$__f_defaultSync)])); + return $j_sjr_vdom_TagLite.$f_Lsjr_vdom_TagLite__apply__T__sci_Seq__Lsjr_vdom_TagOf(this$16, self, xs); + }))).apply__O__O(_$4$1)); + }), $j_sjr_CtorType$Summoner$.$m_Lsjr_CtorType$Summoner$().summonN__Lsjr_internal_Singleton__Lsjr_CtorType$Summoner($j_sjr_internal_Singleton$.$m_Lsjr_internal_Singleton$().Lsjr_internal_Singleton$__f_BoxUnit)); } export { $c_Lsjr_test_emissions_UseState$ }; From 89ee1f2f39b9c40a1e8312922772b761fdaa570f Mon Sep 17 00:00:00 2001 From: David Barri Date: Mon, 6 Jun 2022 11:20:32 +1000 Subject: [PATCH 08/72] Remove useless line --- .../test/scala/japgolly/scalajs/react/core/ReusabilityTest.scala | 1 - 1 file changed, 1 deletion(-) diff --git a/library/tests/src/test/scala/japgolly/scalajs/react/core/ReusabilityTest.scala b/library/tests/src/test/scala/japgolly/scalajs/react/core/ReusabilityTest.scala index d3073e0e9..01b5e8e48 100644 --- a/library/tests/src/test/scala/japgolly/scalajs/react/core/ReusabilityTest.scala +++ b/library/tests/src/test/scala/japgolly/scalajs/react/core/ReusabilityTest.scala @@ -145,7 +145,6 @@ object ReusabilityTest extends TestSuite { private class DerivesByRef { class X implicit val x: Reusability[X] = Reusability.never - val _ = x case class Y(x: X) implicit val y: Reusability[Y] = Reusability.derive[Y] val y1 = Y(new X) From 8197dd3716653675e4deacae9c5486a04723816b Mon Sep 17 00:00:00 2001 From: David Barri Date: Mon, 6 Jun 2022 11:37:49 +1000 Subject: [PATCH 09/72] Checkpoint: UseState on Scala 2 --- .../scalajs/react/hooks/HookMacros.scala | 171 ++++++++++++++++-- .../scalajs/react/component/JsFn.scala | 13 +- .../scalajs/react/component/ScalaFn.scala | 26 ++- .../japgolly/scalajs/react/hooks/Hooks.scala | 13 +- .../scalajs/react/internal/MacroLogger.scala | 72 ++++++++ .../japgolly/scalajs/react/facade/Hooks.scala | 9 + .../react/test/emissions/EmissionTest.scala | 19 +- .../test/emissions/ReactRefreshTest.scala | 61 ++++++- .../react/test/emissions/util/TestJs.scala | 33 ++++ .../react/test/emissions/util/Util.scala | 31 +++- 10 files changed, 375 insertions(+), 73 deletions(-) create mode 100644 library/coreGeneric/src/main/scala/japgolly/scalajs/react/internal/MacroLogger.scala diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala index 2bc3825f9..ac76872ed 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -1,11 +1,12 @@ package japgolly.scalajs.react.hooks import japgolly.microlibs.compiletime.MacroUtils -import japgolly.scalajs.react.{Children, CtorType} import japgolly.scalajs.react.component.ScalaFn.Component import japgolly.scalajs.react.hooks.Api._ -import japgolly.scalajs.react.internal.Box +import japgolly.scalajs.react.internal.{Box, MacroLogger} import japgolly.scalajs.react.vdom.VdomNode +import japgolly.scalajs.react.{Children, CtorType} +import scala.annotation.{nowarn, tailrec} import scala.reflect.macros.blackbox.Context object HookMacros { @@ -19,36 +20,166 @@ object HookMacros { } } -@annotation.nowarn("cat=unused") // TODO: remove +// ===================================================================================================================== + class HookMacros(val c: Context) extends MacroUtils { import c.universe._ - def render[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] - (f: c.Tree)(step: c.Tree, s: c.Tree): c.Tree = { + private implicit def autoTagToType[A](t: c.WeakTypeTag[A]): Type = t.tpe - var debug = false // showCode(c.macroApplication).contains("counter.value") + private def Box : Tree = q"_root_.japgolly.scalajs.react.internal.Box" + private def Box(t: Type): Type = appliedType(c.typeOf[Box[_]], t) + private def Hooks : Tree = q"_root_.japgolly.scalajs.react.hooks.Hooks" + private def JsFn : Tree = q"_root_.japgolly.scalajs.react.component.JsFn" + private def React : Tree = q"_root_.japgolly.scalajs.react.facade.React" + private def ScalaFn : Tree = q"_root_.japgolly.scalajs.react.component.ScalaFn" + private def withHooks = "withHooks" - def println(args: Any*): Unit = - if (debug) System.out.println(args.mkString) + case class HookDefn(propsType: Tree, steps: List[HookStep]) + case class HookStep(name: String, targs: List[Tree], args: List[List[Tree]]) - println("="*120) - println() + def render[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] + (f: c.Tree)(step: c.Tree, s: c.Tree) + (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = { + + implicit val log = MacroLogger() + // log.enabled = showCode(c.macroApplication).contains("counter.value") + log.header() + log("macroApplication", showRaw(c.macroApplication)) val self = c.prefix - val result = q""" - { - val f = $step.squash($f) - $self.render(f)($s) - } - """ + val parsed = parseHookDefn(c.macroApplication, Nil, Nil, Nil) - if (debug) - println("RESULT:\n" + showCode(result)) + val inlined = parsed + .flatMap(inlineHookDefn) + .map(inlineHookRawComponent[P]) + .map(inlineHookComponent[P, C](_, s)) - println() - println("="*120) + val result: Tree = + inlined match { + case Right(r) => + r + case Left(e) => + log(e()) + q""" + val f = $step.squash($f) + $self.render(f)($s) + """ + } + log.footer(showCode(result)) result } + + @tailrec + private def parseHookDefn(tree: Tree, targs: List[Tree], args: List[List[Tree]], steps: List[HookStep]) + (implicit log: MacroLogger): Either[() => String, HookDefn] = + tree match { + + case Apply(t, a) => + parseHookDefn(t, targs, a :: args, steps) + + case TypeApply(t, a) => + if (targs.isEmpty) + parseHookDefn(t, a, args, steps) + else + Left(() => "Multiple type arg clauses found at " + showRaw(tree)) + + case Select(t, n) => + val name = n.toString + if (name == withHooks) { + if (args.nonEmpty) + Left(() => s"$withHooks called with args when none exepcted: ${args.map(_.map(showCode(_)))}") + else + targs match { + case props :: Nil => Right(HookDefn(props, steps)) + case Nil => Left(() => s"$withHooks called without targs, unable to discern Props type.") + case _ => Left(() => s"$withHooks called multiple targs: ${targs.map(showCode(_))}") + } + } else { + val step = HookStep(name, targs, args) + log(s"Found step '$name'", step) + parseHookDefn(t, Nil, Nil, step :: steps) + } + + case _ => + Left(() => "Don't know how to parse " + showRaw(tree)) + } + + private type RenderInliner = (Tree, Init) => Tree + + private def inlineHookDefn(h: HookDefn)(implicit log: MacroLogger): Either[() => String, RenderInliner] = { + val init = new Init("hook" + _, lazyVals = false) + val it = h.steps.iterator + var stepId = 0 + var renderStep: HookStep = null + var hooks = List.empty[TermName] + while (it.hasNext) { + val step = it.next() + if (it.hasNext) { + stepId += 1 + inlineHookStep(stepId, step, init) match { + case Right(termName) => hooks ::= termName + case Left(e) => return Left(e) + } + } else + renderStep = step + } + hooks = hooks.reverse + + hookRenderInliner(renderStep, hooks.map(Ident(_))).map { f => + (props, init2) => { + init2 ++= init.stmts + f(props, init2) + } + } + } + + private def inlineHookStep(stepId: Int, step: HookStep, init: Init)(implicit log: MacroLogger): Either[() => String, TermName] = { + log("inlineHookStep." + step.name, step) + step.name match { + case "useState" => + val stateType = step.targs.head + val arg = step.args.head.head + val rawName = TermName("hook" + stepId + "_raw") + val name = TermName("hook" + stepId) + init += q"val $rawName = $React.useStateFn(() => $Box[$stateType]($arg))" + init += q"val $name = $Hooks.UseState.fromJsBoxed[$stateType]($rawName)" + Right(name) + + case _ => + Left(() => s"Inlining of hook method '${step.name}' not yet supported.") + } + } + + private def hookRenderInliner(step: HookStep, hooks: List[Tree])(implicit log: MacroLogger): Either[() => String, RenderInliner] = { + log("inlineHookRender." + step.name, step) + step.name match { + case "render" => + @nowarn("msg=exhaustive") val List(List(renderFn), _) = step.args + Right { (props, _) => + val args = props :: hooks + Apply(Select(renderFn, TermName("apply")), args) + } + + case _ => + Left(() => s"Inlining of hook render method '${step.name}' not yet supported.") + } + } + + private def inlineHookRawComponent[P](renderInliner: RenderInliner)(implicit P: c.WeakTypeTag[P]): Tree = { + val props_unbox = q"props.unbox" + val init = new Init("_i" + _) + val render1 = renderInliner(props_unbox, init) + val render2 = init.wrap(q"$render1.rawNode") + q"(props => $render2): $JsFn.RawComponent[${Box(P)}]" + } + + private def inlineHookComponent[P, C <: Children](rawComp: Tree, summoner: c.Tree)(implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): Tree = { + c.untypecheck(q""" + val rawComponent = $rawComp + $ScalaFn.fromBoxed($JsFn.fromJsFn[${Box(P)}, $C](rawComponent)($summoner)) + """) + } } diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/component/JsFn.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/component/JsFn.scala index 94c44c62a..e57669701 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/component/JsFn.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/component/JsFn.scala @@ -11,9 +11,10 @@ import scala.scalajs.js object JsFn extends JsBaseComponentTemplate[facade.React.StatelessFunctionalComponent] { - type Component[P <: js.Object, CT[-p, +u] <: CtorType[p, u]] = ComponentRoot[P, CT, Unmounted[P]] - type Unmounted[P <: js.Object] = UnmountedRoot[P] - type Mounted = Unit + type RawComponent[P <: js.Object] = js.Function1[P with facade.PropsWithChildren, facade.React.Node] + type Component [P <: js.Object, CT[-p, +u] <: CtorType[p, u]] = ComponentRoot[P, CT, Unmounted[P]] + type Unmounted [P <: js.Object] = UnmountedRoot[P] + type Mounted = Unit def apply[P <: js.Object, C <: Children] (raw: js.Any) @@ -27,9 +28,9 @@ object JsFn extends JsBaseComponentTemplate[facade.React.StatelessFunctionalComp componentRoot[P, s.CT, Unmounted[P]](rc, s.pf.rmap(s.summon(rc))(unmountedRoot))(s.pf) } - def fromJsFn[P <: js.Object, C <: Children](render: js.Function1[P with facade.PropsWithChildren, facade.React.Element]) - (implicit s: CtorType.Summoner[P, C]): Component[P, s.CT] = - JsFn.force[P, C](render)(s) + // TODO: This name... fromRaw? fromJs? Is it consistent across the project? + @inline def fromJsFn[P <: js.Object, C <: Children](render: RawComponent[P])(implicit s: CtorType.Summoner[P, C]): Component[P, s.CT] = + force[P, C](render)(s) /** Type used when creating a JsFnComponent that ignores its props */ type UnusedObject = Box[Unit] diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/component/ScalaFn.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/component/ScalaFn.scala index 0fc3d6a75..d3a2f80d1 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/component/ScalaFn.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/component/ScalaFn.scala @@ -4,7 +4,6 @@ import japgolly.scalajs.react.hooks.HookComponentBuilder import japgolly.scalajs.react.internal._ import japgolly.scalajs.react.vdom.VdomNode import japgolly.scalajs.react.{Children, CtorType, PropsChildren, Reusability, facade} -import scala.scalajs.js object ScalaFn { @@ -12,22 +11,12 @@ object ScalaFn { type Unmounted[P] = JsFn.UnmountedWithRoot[P, Mounted, Box[P]] type Mounted = JsFn.Mounted - private def create[P, C <: Children, CT[-p, +u] <: CtorType[p, u]] - (render: Box[P] with facade.PropsWithChildren => VdomNode) - (implicit s: CtorType.Summoner.Aux[Box[P], C, CT]): Component[P, CT] = { - - val jsRender = render.andThen(_.rawNode): js.Function1[Box[P] with facade.PropsWithChildren, facade.React.Node] - val rawComponent = jsRender.asInstanceOf[facade.React.StatelessFunctionalComponent[Box[P]]] - JsFn.force[Box[P], C](rawComponent)(s) - .cmapCtorProps[P](Box(_)) - .mapUnmounted(_.mapUnmountedProps(_.unbox)) - } + def fromBoxed[P, CT[-p, +u] <: CtorType[p, u]](js: JsFn.Component[Box[P], CT]): Component[P, CT] = + js.cmapCtorProps[P](Box(_)).mapUnmounted(_.mapUnmountedProps(_.unbox)) @inline def withHooks[P] = HookComponentBuilder.apply[P] - // =================================================================================================================== - def apply[P](render: P => VdomNode)(implicit s: CtorType.Summoner[Box[P], Children.None]): Component[P, s.CT] = create[P, Children.None, s.CT](b => render(b.unbox))(s) @@ -37,8 +26,6 @@ object ScalaFn { def justChildren(render: PropsChildren => VdomNode): Component[Unit, CtorType.Children] = create(b => render(PropsChildren(b.children))) - // =================================================================================================================== - def withReuse[P](render: P => VdomNode)(implicit s: CtorType.Summoner[Box[P], Children.None], r: Reusability[P]): Component[P, s.CT] = withHooks[P].renderWithReuse(render)(s, r) @@ -50,4 +37,13 @@ object ScalaFn { def withChildrenAndReuse[P, A](reusableInputs: (P, PropsChildren) => A)(render: A => VdomNode)(implicit s: CtorType.Summoner[Box[P], Children.Varargs], r: Reusability[A]): Component[P, s.CT] = withHooks[P].withPropsChildren.renderWithReuseBy(i => reusableInputs(i.props, i.propsChildren))(render) + + // =================================================================================================================== + + private def create[P, C <: Children, CT[-p, +u] <: CtorType[p, u]] + (render: Box[P] with facade.PropsWithChildren => VdomNode) + (implicit s: CtorType.Summoner.Aux[Box[P], C, CT]): Component[P, CT] = { + val jsRender: JsFn.RawComponent[Box[P]] = render(_).rawNode + fromBoxed(JsFn.fromJsFn[Box[P], C](jsRender)(s)) + } } diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Hooks.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Hooks.scala index 16a7abd48..0efa2745f 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Hooks.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Hooks.scala @@ -249,11 +249,14 @@ object Hooks { def unsafeCreate[S](initialState: => S): UseState[S] = { // Boxing is required because React's useState uses reflection to distinguish between {set,mod}State. - val initialStateFn = (() => Box(initialState)): js.Function0[Box[S]] - val originalResult = facade.React.useState[Box[S]](initialStateFn) - val originalSetState = Reusable.byRef(originalResult._2) - UseState(originalResult, originalSetState) - .xmap(_.unbox)(Box.apply) + val initialStateFn = (() => Box(initialState)): js.Function0[Box[S]] + val originalResult = facade.React.useStateFn[Box[S]](initialStateFn) + fromJsBoxed(originalResult) + } + + def fromJsBoxed[S](r: facade.React.UseState[Box[S]]): UseState[S] = { + val originalSetState = Reusable.byRef(r._2) + UseState(r, originalSetState).xmap(_.unbox)(Box.apply) } } diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/internal/MacroLogger.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/internal/MacroLogger.scala new file mode 100644 index 000000000..2b3bdec44 --- /dev/null +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/internal/MacroLogger.scala @@ -0,0 +1,72 @@ +package japgolly.scalajs.react.internal + +import sourcecode.Line + +// TODO: Move into microlibs +object MacroLogger { + + def apply(): MacroLogger = + new MacroLogger + + def apply(enabled: Boolean): MacroLogger = { + val l = new MacroLogger + l.enabled = enabled + l + } +} + +class MacroLogger { + import Console._ + + private var enabledStack = List.empty[Boolean] + + var enabled = false + + def pushDisabled(): Unit = + pushEnabled(false) + + def pushEnabled(e: Boolean = true): Unit = { + enabledStack ::= enabled + enabled = e + } + + def pop(): Unit = + if (enabledStack.nonEmpty) { + enabled = enabledStack.head + enabledStack = enabledStack.tail + } + + def apply(): Unit = + if (enabled) + System.out.println() + + def apply(a: => Any)(implicit l: Line): Unit = + if (enabled) { + val text = "" + a + // for (line <- text.linesIterator) { + // System.out.printf("%s[%3d]%s %s\n", CYAN, l.value, RESET, line) + // } + System.out.printf("%s[%3d]%s %s\n", CYAN, l.value, RESET, text.replace("\n", "\n ")) + } + + private def _println(a: => Any): Unit = + if (enabled) + System.out.println(a) + + private def width = 200 + private def sep = "=" * width + + def header(): Unit = + _println(sep + "\n") + + def footer(): Unit = + _println("\n" + sep) + + def footer(result: => Any): Unit = { + apply("Result", result) + footer() + } + + def apply(name: => Any, value: => Any)(implicit l: Line): Unit = + apply(s"$YELLOW$name:$RESET $value") +} diff --git a/library/facadeMain/src/main/scala/japgolly/scalajs/react/facade/Hooks.scala b/library/facadeMain/src/main/scala/japgolly/scalajs/react/facade/Hooks.scala index d892d3eb1..331abcc10 100644 --- a/library/facadeMain/src/main/scala/japgolly/scalajs/react/facade/Hooks.scala +++ b/library/facadeMain/src/main/scala/japgolly/scalajs/react/facade/Hooks.scala @@ -2,6 +2,7 @@ package japgolly.scalajs.react.facade import scala.annotation.nowarn import scala.scalajs.js +import scala.scalajs.js.annotation._ import scala.scalajs.js.| /** See https://reactjs.org/docs/hooks-reference.html @@ -19,6 +20,14 @@ trait Hooks extends js.Object { final def useState[S](initial: S | js.Function0[S]): UseState[S] = js.native + /** Using this directly avoid Scala.js adding boilerplate for `|` */ + @JSName("useState") + final def useStateFn[S](initial: js.Function0[S]): UseState[S] = js.native + + /** Using this directly avoid Scala.js adding boilerplate for `|` */ + @JSName("useState") + final def useStateValue[S](initial: S): UseState[S] = js.native + final type UseEffectArg = js.Function0[js.UndefOr[js.Function0[Any]]] final def useEffect(effect: UseEffectArg, deps : js.UndefOr[HookDeps] = js.native): Unit = js.native diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/EmissionTest.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/EmissionTest.scala index ce281c8a7..67c479ea3 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/EmissionTest.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/EmissionTest.scala @@ -10,9 +10,10 @@ object EmissionTest extends TestSuite { override def tests = Tests { "UseState" - testScala(hack = TestJs.Hack { _ - .dropLinesUntil(_ startsWith "function ") - .takeLinesTo(_ startsWith "export ") - }) + .dropLinesUntil(_ endsWith " = function (props) {") + .takeLinesTo(_ == "};") + }, golden = false) + } // =================================================================================================================== @@ -45,15 +46,7 @@ object EmissionTest extends TestSuite { // Make output much more readable, we're not testing the validity of SJS here if (normalise) - js.modifyLines(_ - .replace("_", "_") - .replace("$0024", "$") - .replace("$002e", "_") // "." - .replace("$005f", "_") - .replace("$less$up", "") - .replace("japgolly_scalajs_react_", "sjr_") - .replaceAll("scala_scalajs_runtime_(?=AnonFunction|WrappedVarArgs)", "") - ) + TestJs.Hack.humanReadable.run(js) if (hack ne null) hack.run(js) @@ -73,7 +66,7 @@ object EmissionTest extends TestSuite { } finally { val didNothing = !golden && expectedFrags.isEmpty if (showResult || didNothing) - Util.debugShowContent(s"$name.scala JS", actual, "\u001b[107;30m") + Util.debugShowContent(s"$name.scala JS", actual, "\u001b[107;30m", rrFlags = false) } utestOutput diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala index 56fce15ea..df62368ce 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala @@ -2,6 +2,7 @@ package japgolly.scalajs.react.test.emissions import japgolly.microlibs.utils.FileUtils import japgolly.scalajs.react.test.emissions.util._ +import scala.annotation.nowarn import scala.util.Try import utest._ import utest.framework.TestPath @@ -14,6 +15,8 @@ object ReactRefreshTest extends TestSuite { "demo" - testJs() // "temp" - testJs() } + + // "UseState" - showScala() } // =================================================================================================================== @@ -36,14 +39,42 @@ object ReactRefreshTest extends TestSuite { babel.assertOrSaveOutput(expectFilename) } + /** Load scalajs-react output JS, run ReactRefresh transforms over it, and confirm the result. */ + @nowarn("cat=unused") + protected def showScala(assertRR : Boolean = false, + assertNoRR : Boolean = false, + assertBabelChanges: Boolean = false, + showPreBabel : Boolean = true, + showResult : Boolean = false, + showDiff : Boolean = true, + golden : Boolean = false, + hack : TestJs.Hack = null, + onShow : TestJs.Hack = TestJs.Hack.humanReadable, + expectedFrags : Seq[String] = Seq.empty) + (implicit tp : TestPath) = + testScala( + assertRR = false, + assertNoRR = false, + assertBabelChanges = false, + showPreBabel = showPreBabel, + showResult = showResult, + showDiff = showDiff, + golden = false, + hack = hack, + onShow = onShow, + expectedFrags = expectedFrags, + ) + /** Load scalajs-react output JS, run ReactRefresh transforms over it, and confirm the result. */ protected def testScala(assertRR : Boolean = true, assertNoRR : Boolean = false, assertBabelChanges: Boolean = true, - showResult : Boolean = false, showPreBabel : Boolean = false, + showResult : Boolean = false, + showDiff : Boolean = false, golden : Boolean = true, hack : TestJs.Hack = null, + onShow : TestJs.Hack = TestJs.Hack.humanReadable, expectedFrags : Seq[String] = Seq.empty) (implicit tp : TestPath) = { @@ -90,22 +121,34 @@ object ReactRefreshTest extends TestSuite { if (golden) utestOutput = babel.assertOrSaveOutput(expectFilename) - if (utestOutput == () && assertRR) - utestOutput = - babel.after.replace('\n', ' ') match { - case rrSigHashRegex(h) => h - case _ => "Failed to find the RefreshSig state id" - } + if (utestOutput == ()) + reactRefreshSignature(babel.after) match { + case Some(sig) => utestOutput = sig + case None => + if (assertRR) + utestOutput = "Failed to find the RefreshSig state id" + } } finally { + def show(s: String): String = onShow.runAnon(s).content + lazy val before = show(babel.before) + lazy val after = show(babel.after) if (showPreBabel) - Util.debugShowContent(s"$name.scala JS pre-babel", babel.before, "\u001b[107;30m") + Util.debugShowContent(s"$name.scala JS pre-babel", before, "\u001b[107;30m", rrFlags = false) if (showResult) - Util.debugShowContent(s"$name.scala JS post-babel", babel.after, "\u001b[107;30m") + Util.debugShowContent(s"$name.scala JS post-babel", after, "\u001b[107;30m") + if (showDiff) + Util.debugShowDiff(before, after) } utestOutput } private val rrSigHashRegex = """.*, ?"([a-zA-Z0-9/+]{27}=)"\);.*""".r + + private def reactRefreshSignature(js: String): Option[String] = + js.replace('\n', ' ') match { + case rrSigHashRegex(h) => Some(h) + case _ => None + } } diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala index a52412582..408179ded 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala @@ -18,5 +18,38 @@ object TestJs { def when (f: TestJs => Boolean): Hack = Hack { js => if (f(js)) run(js) } def unless(b: Boolean) : Hack = unless(_ => b) def unless(f: TestJs => Boolean): Hack = when(!f(_)) + def disable : Hack = Hack.none + + def runAnon(jsContent: String): TestJs = { + val js = new TestJs("anon", "anon.js", jsContent) + run(js) + js + } + } + + object Hack { + def none: Hack = + apply(_ => ()) + + // Make much more readable for human eyes. (Note: breaks the validity of the JS) + val humanReadable: Hack = { + + // Lines that simply initialise object singletons + val objectInit = """^ *(?:\$j_[a-zA-Z_]+\$\.)?\$m_[a-zA-Z_]+\$\(\);$""".r + + apply(_ + .modifyLines(_ + .replace("_", "_") + .replace("$0024", "$") + .replace("$002e", "_") // "." + .replace("$005f", "_") + .replace("$less$up", "") + .replace("japgolly_scalajs_react_", "sjr_") + .replace("japgolly$scalajs$react$", "sjr$") + .replaceAll("scala_scalajs_runtime_(?=AnonFunction|WrappedVarArgs)", "") + ) + .filterNot(objectInit) + ) + } } } diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Util.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Util.scala index f26d93be9..3182f694a 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Util.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Util.scala @@ -28,12 +28,19 @@ object Util { go(str, 0) } - def debugShowContent(name: String, content: String, colour: String): Unit = { + def debugShowContent(name: String, content: String, colour: String, rrFlags: Boolean = true): Unit = { val batPath = "/usr/bin/bat" var useBat = (new File(batPath)).exists() - val rr = containsRR(content) - val rrDesc = if (rr) "\u001b[102;30m[RR]" else "\u001b[101;97m[RR]" - val sep = "=" * (name.length + 5) + + val rrDesc = + if (rrFlags) { + val rr = containsRR(content) + val flags = if (rr) "\u001b[102;30m[RR:Y]" else "\u001b[101;97m[RR:N]" + flags + Console.RESET + " " + } else + "" + + val sep = "=" * (name.length + (if (rrFlags) 7 else 0)) val content2 = { val sb = new java.lang.StringBuilder @@ -58,7 +65,7 @@ object Util { } println(sep) - println(rrDesc + Console.RESET + " " + colour + name + Console.RESET) + println(rrDesc + colour + name + Console.RESET) println(sep) if (useBat) { val f = writeToTempFile(".js")(content2) @@ -74,6 +81,20 @@ object Util { println() } + def debugShowDiff(content1: String, content2: String): Unit = { + var diffPath = "/usr/bin/colordiff" + if (!(new File(diffPath)).exists()) + diffPath = "diff" + + val file1 = writeToTempFile("")(content1) + val file2 = writeToTempFile("")(content2) + + val sep = Console.YELLOW_B + Console.BLACK + ("=" * 120) + Console.RESET + println(sep) + Seq(diffPath, "-uw", file1, file2).#|(Seq("tail", "+3")).! + println(sep) + } + def getFileContent(path: String): Option[String] = { val f = new File(path) Option.when(f.exists())(readSource(Source.fromFile(f))) From d3b8a091a84c5afd21f1aea07a9754cd48a1cead Mon Sep 17 00:00:00 2001 From: David Barri Date: Mon, 6 Jun 2022 12:07:50 +1000 Subject: [PATCH 10/72] HookDefn propsType not needed --- .../scala-2/japgolly/scalajs/react/hooks/HookMacros.scala | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala index ac76872ed..c12d5a2a0 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -35,7 +35,7 @@ class HookMacros(val c: Context) extends MacroUtils { private def ScalaFn : Tree = q"_root_.japgolly.scalajs.react.component.ScalaFn" private def withHooks = "withHooks" - case class HookDefn(propsType: Tree, steps: List[HookStep]) + case class HookDefn(steps: List[HookStep]) case class HookStep(name: String, targs: List[Tree], args: List[List[Tree]]) def render[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] @@ -92,11 +92,7 @@ class HookMacros(val c: Context) extends MacroUtils { if (args.nonEmpty) Left(() => s"$withHooks called with args when none exepcted: ${args.map(_.map(showCode(_)))}") else - targs match { - case props :: Nil => Right(HookDefn(props, steps)) - case Nil => Left(() => s"$withHooks called without targs, unable to discern Props type.") - case _ => Left(() => s"$withHooks called multiple targs: ${targs.map(showCode(_))}") - } + Right(HookDefn(steps)) } else { val step = HookStep(name, targs, args) log(s"Found step '$name'", step) From 39ce3dc483ccd9b635a85d441ac6289b01344a20 Mon Sep 17 00:00:00 2001 From: David Barri Date: Mon, 6 Jun 2022 18:17:19 +1000 Subject: [PATCH 11/72] Handle `useStateBy` and `withPropsChildren` --- .../scalajs/react/hooks/HookMacros.scala | 190 +++++++++++++----- .../japgolly/scalajs/react/internal/Box.scala | 2 +- .../scalajs/react/internal/MacroLogger.scala | 11 + .../test/emissions/HooksWithChildren.scala | 19 ++ .../scalajs/react/test/emissions/Main.scala | 4 +- .../test/emissions/NoHooksWithChildren.scala | 14 ++ .../react/test/emissions/UseState.scala | 11 +- .../jvm/src/test/resources/rr-js/fn-in.js | 7 + .../jvm/src/test/resources/rr-js/fn-out.js | 12 ++ .../rr-js/{demo-in.js => hooks-in.js} | 0 .../rr-js/{demo-out.js => hooks-out.js} | 0 .../rr-sjr/HooksWithChildren-out2.js | 91 +++++++++ .../test/resources/rr-sjr/UseState-out2.js | 110 ++++++++++ .../src/test/resources/sjr/UseState-out2.js | 34 ---- .../src/test/resources/sjr/UseState-out3.js | 41 ---- .../react/test/emissions/EmissionTest.scala | 8 +- .../test/emissions/ReactRefreshTest.scala | 16 +- .../react/test/emissions/util/Babel.scala | 10 +- .../react/test/emissions/util/TestJs.scala | 2 +- .../react/test/emissions/util/Util.scala | 7 +- 20 files changed, 449 insertions(+), 140 deletions(-) create mode 100644 library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksWithChildren.scala create mode 100644 library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/NoHooksWithChildren.scala create mode 100644 library/testEmissions/jvm/src/test/resources/rr-js/fn-in.js create mode 100644 library/testEmissions/jvm/src/test/resources/rr-js/fn-out.js rename library/testEmissions/jvm/src/test/resources/rr-js/{demo-in.js => hooks-in.js} (100%) rename library/testEmissions/jvm/src/test/resources/rr-js/{demo-out.js => hooks-out.js} (100%) create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out2.js create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out2.js delete mode 100644 library/testEmissions/jvm/src/test/resources/sjr/UseState-out2.js delete mode 100644 library/testEmissions/jvm/src/test/resources/sjr/UseState-out3.js diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala index c12d5a2a0..69ab581e2 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -27,23 +27,74 @@ class HookMacros(val c: Context) extends MacroUtils { private implicit def autoTagToType[A](t: c.WeakTypeTag[A]): Type = t.tpe - private def Box : Tree = q"_root_.japgolly.scalajs.react.internal.Box" - private def Box(t: Type): Type = appliedType(c.typeOf[Box[_]], t) - private def Hooks : Tree = q"_root_.japgolly.scalajs.react.hooks.Hooks" - private def JsFn : Tree = q"_root_.japgolly.scalajs.react.component.JsFn" - private def React : Tree = q"_root_.japgolly.scalajs.react.facade.React" - private def ScalaFn : Tree = q"_root_.japgolly.scalajs.react.component.ScalaFn" - private def withHooks = "withHooks" + private def Box : Tree = q"_root_.japgolly.scalajs.react.internal.Box" + private def Box(t: Type) : Type = appliedType(c.typeOf[Box[_]], t) + private def HookCtx : Tree = q"_root_.japgolly.scalajs.react.hooks.HookCtx" + private def Hooks : Tree = q"_root_.japgolly.scalajs.react.hooks.Hooks" + private def JsFn : Tree = q"_root_.japgolly.scalajs.react.component.JsFn" + private def PropsChildren: Tree = q"_root_.japgolly.scalajs.react.PropsChildren" + private def React : Tree = q"_root_.japgolly.scalajs.react.facade.React" + private def ScalaFn : Tree = q"_root_.japgolly.scalajs.react.component.ScalaFn" + private def withHooks = "withHooks" - case class HookDefn(steps: List[HookStep]) - case class HookStep(name: String, targs: List[Tree], args: List[List[Tree]]) + private case class HookDefn(steps: List[HookStep]) + + private case class HookStep(name: String, targs: List[Tree], args: List[List[Tree]]) + + private class HookRewriter(props: Tree, initChildren: Tree, propsChildren: Tree) { + private var stmts = Vector.empty[Tree] + private var hooks = List.empty[Ident] + private var _hookCount = 0 + private var _usesChildren = false + + def usesChildren() = + _usesChildren + + def useChildren(): Unit = { + _usesChildren = true + this += initChildren + } + + def +=(stmt: Tree): Unit = + stmts :+= stmt + + def hookCount(): Int = + _hookCount + + def nextHookName(suffix: String = ""): TermName = + TermName("hook" + (hookCount() + 1) + suffix) + + def registerHook(h: TermName): Unit = { + hooks :+= Ident(h) + _hookCount += 1 + } + + def args(): List[Tree] = + if (usesChildren()) + props :: propsChildren :: hooks + else + props :: hooks + + def ctxArg(): Tree = { + val hookCtxObj = if (usesChildren()) q"$HookCtx.withChildren" else HookCtx + val create = Apply(hookCtxObj, args()) + val name = nextHookName("_ctx") + this += q"val $name = $create" + Ident(name) + } + + def wrap(body: Tree): Tree = + q"..$stmts; $body" + } + + // ------------------------------------------------------------------------------------------------------------------- def render[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] (f: c.Tree)(step: c.Tree, s: c.Tree) (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = { implicit val log = MacroLogger() - // log.enabled = showCode(c.macroApplication).contains("counter.value") + log.enabled = showCode(c.macroApplication).contains("DEBUG") // TODO: DELETE log.header() log("macroApplication", showRaw(c.macroApplication)) @@ -103,72 +154,90 @@ class HookMacros(val c: Context) extends MacroUtils { Left(() => "Don't know how to parse " + showRaw(tree)) } - private type RenderInliner = (Tree, Init) => Tree - - private def inlineHookDefn(h: HookDefn)(implicit log: MacroLogger): Either[() => String, RenderInliner] = { - val init = new Init("hook" + _, lazyVals = false) + private def inlineHookDefn(h: HookDefn)(implicit log: MacroLogger): Either[() => String, HookRewriter => Tree] = { val it = h.steps.iterator - var stepId = 0 var renderStep: HookStep = null - var hooks = List.empty[TermName] + var hooks = Vector.empty[HookRewriter => TermName] + var withPropsChildren = false while (it.hasNext) { val step = it.next() if (it.hasNext) { - stepId += 1 - inlineHookStep(stepId, step, init) match { - case Right(termName) => hooks ::= termName - case Left(e) => return Left(e) - } + if (hooks.isEmpty && step.name == "withPropsChildren") + withPropsChildren = true + else + inlineHookStep(step) match { + case Right(h) => hooks :+= h + case Left(e) => return Left(e) + } } else renderStep = step } - hooks = hooks.reverse - hookRenderInliner(renderStep, hooks.map(Ident(_))).map { f => - (props, init2) => { - init2 ++= init.stmts - f(props, init2) - } + hookRenderInliner(renderStep).map { buildRender => b => + if (withPropsChildren) + b.useChildren() + for (h <- hooks) + b registerHook h(b) + buildRender(b) } } - private def inlineHookStep(stepId: Int, step: HookStep, init: Init)(implicit log: MacroLogger): Either[() => String, TermName] = { + private def inlineHookStep(step: HookStep)(implicit log: MacroLogger): Either[() => String, HookRewriter => TermName] = { log("inlineHookStep." + step.name, step) + + def useState(b: HookRewriter, tpe: Tree, body: Tree) = { + val rawName = b.nextHookName("_raw") + val name = b.nextHookName() + b += q"val $rawName = $React.useStateFn(() => $Box[$tpe]($body))" + b += q"val $name = $Hooks.UseState.fromJsBoxed[$tpe]($rawName)" + name + } + step.name match { + case "useState" => - val stateType = step.targs.head - val arg = step.args.head.head - val rawName = TermName("hook" + stepId + "_raw") - val name = TermName("hook" + stepId) - init += q"val $rawName = $React.useStateFn(() => $Box[$stateType]($arg))" - init += q"val $name = $Hooks.UseState.fromJsBoxed[$stateType]($rawName)" - Right(name) + val targ = step.targs.head + val arg = step.args.head.head + Right(useState(_, targ, arg)) + + case "useStateBy" => + val targ = step.targs.head + val arg = step.args.head.head + arg match { + case f@ Function(params, _) => + if (params.sizeIs == 1) + Right { b => + val ctxArg = b.ctxArg() + useState(b, targ, call(f, ctxArg :: Nil)) + } + else + Right(b => useState(b, targ, call(f, b.args()))) + + case _ => + Left(() => s"Expected a function, found: ${showRaw(arg)}") + } case _ => Left(() => s"Inlining of hook method '${step.name}' not yet supported.") } } - private def hookRenderInliner(step: HookStep, hooks: List[Tree])(implicit log: MacroLogger): Either[() => String, RenderInliner] = { + private def hookRenderInliner(step: HookStep)(implicit log: MacroLogger): Either[() => String, HookRewriter => Tree] = { log("inlineHookRender." + step.name, step) step.name match { case "render" => @nowarn("msg=exhaustive") val List(List(renderFn), _) = step.args - Right { (props, _) => - val args = props :: hooks - Apply(Select(renderFn, TermName("apply")), args) - } + Right(b => call(renderFn, b.args())) case _ => Left(() => s"Inlining of hook render method '${step.name}' not yet supported.") } } - private def inlineHookRawComponent[P](renderInliner: RenderInliner)(implicit P: c.WeakTypeTag[P]): Tree = { - val props_unbox = q"props.unbox" - val init = new Init("_i" + _) - val render1 = renderInliner(props_unbox, init) - val render2 = init.wrap(q"$render1.rawNode") + private def inlineHookRawComponent[P](rewrite: HookRewriter => Tree)(implicit P: c.WeakTypeTag[P]): Tree = { + val b = new HookRewriter(q"props.unbox", q"val children = $PropsChildren.fromRawProps(props)", q"children") + val render1 = rewrite(b) + val render2 = b.wrap(q"$render1.rawNode") q"(props => $render2): $JsFn.RawComponent[${Box(P)}]" } @@ -178,4 +247,35 @@ class HookMacros(val c: Context) extends MacroUtils { $ScalaFn.fromBoxed($JsFn.fromJsFn[${Box(P)}, $C](rawComponent)($summoner)) """) } + + // ------------------------------------------------------------------------------------------------------------------- + + private def call(function: Tree, args: List[Tree]): Tree = { + import internal._ + + function match { + case Function(params, body) => + + // From scala/test/files/run/macro-range/Common_1.scala + class TreeSubstituter(from: List[Symbol], to: List[Tree]) extends Transformer { + override def transform(tree: Tree): Tree = tree match { + case Ident(_) => + def subst(from: List[Symbol], to: List[Tree]): Tree = + if (from.isEmpty) tree + else if (tree.symbol == from.head) to.head.duplicate + else subst(from.tail, to.tail); + subst(from, to) + case _ => + val tree1 = super.transform(tree) + if (tree1 ne tree) setType(tree1, null) + tree1 + } + } + val t = new TreeSubstituter(params.map(_.symbol), args) + t.transform(body) + + case _ => + Apply(Select(function, TermName("apply")), args) + } + } } diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/internal/Box.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/internal/Box.scala index 7eb205eb9..fc7ab71bc 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/internal/Box.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/internal/Box.scala @@ -9,7 +9,7 @@ trait Box[+A] extends js.Object { } object Box { - @inline def apply[A](value: A): Box[A] = + def apply[A](value: A): Box[A] = js.Dynamic.literal(a = value.asInstanceOf[js.Any]).asInstanceOf[Box[A]] val Unit: Box[Unit] = diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/internal/MacroLogger.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/internal/MacroLogger.scala index 2b3bdec44..fc2bacffd 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/internal/MacroLogger.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/internal/MacroLogger.scala @@ -69,4 +69,15 @@ class MacroLogger { def apply(name: => Any, value: => Any)(implicit l: Line): Unit = apply(s"$YELLOW$name:$RESET $value") + + def all(name: => Any, values: => Iterable[Any])(implicit l: Line): Unit = + if (enabled) { + val vs = values + val total = vs.size + var i = 0 + for (v <- vs) { + i += 1 + apply(s"$name [$i/$total]", v) + } + } } diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksWithChildren.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksWithChildren.scala new file mode 100644 index 000000000..8254de9e8 --- /dev/null +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksWithChildren.scala @@ -0,0 +1,19 @@ +package japgolly.scalajs.react.test.emissions + +import japgolly.scalajs.react._ +import japgolly.scalajs.react.vdom.html_<^._ + +object HooksWithChildren { + + val Component = ScalaFnComponent.withHooks[Int] + .withPropsChildren + .useState(123) + .render { (p, c, s1) => + val sum = p + s1.value + c.count + <.button( + "Sum = ", sum, + ^.onClick --> s1.modState(_ + 1), + c + ) + } +} diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala index fe01e6602..f4d324aaf 100644 --- a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala @@ -14,7 +14,9 @@ object Main { private val Component = ScalaFnComponent[Unit] { _ => <.div( - UseState.Component(), + HooksWithChildren.Component(0)(<.div), + NoHooksWithChildren.Component(0)(<.div), + UseState.Component(0), ) } } diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/NoHooksWithChildren.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/NoHooksWithChildren.scala new file mode 100644 index 000000000..38090e67b --- /dev/null +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/NoHooksWithChildren.scala @@ -0,0 +1,14 @@ +package japgolly.scalajs.react.test.emissions + +import japgolly.scalajs.react._ +import japgolly.scalajs.react.vdom.html_<^._ + +object NoHooksWithChildren { + + val Component = ScalaFnComponent.withHooks[Int] + .withPropsChildren + .render { (p, c) => + val sum = p + c.count + <.div("DEBUG = ", sum) + } +} diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseState.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseState.scala index e685d6bd1..fa0e3bd99 100644 --- a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseState.scala +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseState.scala @@ -5,12 +5,15 @@ import japgolly.scalajs.react.vdom.html_<^._ object UseState { - val Component = ScalaFnComponent.withHooks[Unit] + val Component = ScalaFnComponent.withHooks[Int] .useState(123) - .render { (_, s) => + .useStateBy((p, s1) => p + s1.value) + .useStateBy($ => $.props + $.hook1.value + $.hook2.value) + .render { (_, s1, s2, s3) => + val sum = s1.value + s2.value + s3.value <.button( - "Count is ", s.value, - ^.onClick --> s.modState(_ + 1), + "Sum = ", sum, + ^.onClick --> s1.modState(_ + 1), ) } } diff --git a/library/testEmissions/jvm/src/test/resources/rr-js/fn-in.js b/library/testEmissions/jvm/src/test/resources/rr-js/fn-in.js new file mode 100644 index 000000000..d3ce852c3 --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-js/fn-in.js @@ -0,0 +1,7 @@ +import React from 'react' + +function App() { + return React.createElement("div", {}, "count is: 0"); +} + +export default App diff --git a/library/testEmissions/jvm/src/test/resources/rr-js/fn-out.js b/library/testEmissions/jvm/src/test/resources/rr-js/fn-out.js new file mode 100644 index 000000000..db4a7b468 --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-js/fn-out.js @@ -0,0 +1,12 @@ +import React from 'react'; + +function App() { + return React.createElement("div", {}, "count is: 0"); +} + +_c = App; +export default App; + +var _c; + +$RefreshReg$(_c, "App"); diff --git a/library/testEmissions/jvm/src/test/resources/rr-js/demo-in.js b/library/testEmissions/jvm/src/test/resources/rr-js/hooks-in.js similarity index 100% rename from library/testEmissions/jvm/src/test/resources/rr-js/demo-in.js rename to library/testEmissions/jvm/src/test/resources/rr-js/hooks-in.js diff --git a/library/testEmissions/jvm/src/test/resources/rr-js/demo-out.js b/library/testEmissions/jvm/src/test/resources/rr-js/hooks-out.js similarity index 100% rename from library/testEmissions/jvm/src/test/resources/rr-js/demo-out.js rename to library/testEmissions/jvm/src/test/resources/rr-js/hooks-out.js diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out2.js new file mode 100644 index 000000000..0b18166aa --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out2.js @@ -0,0 +1,91 @@ +'use strict'; + +var _s = $RefreshSig$(); + +import * as $i_react from "react"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ePropsChildren from "./japgolly.scalajs.react.PropsChildren.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusable$0024 from "./japgolly.scalajs.react.Reusable$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF from "./japgolly.scalajs.react.hooks.Hooks$UseStateF.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 from "./japgolly.scalajs.react.internal.Singleton$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024 from "./japgolly.scalajs.react.vdom.Attr$EventCallback$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement from "./japgolly.scalajs.react.vdom.VdomElement.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002eFunction1 from "./scala.Function1.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; +import * as $j_scala$002escalajs$002eruntime$002eWrappedVarArgs from "./scala.scalajs.runtime.WrappedVarArgs.js"; + +function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$() { + this.Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$__f_Component = null; + $n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$ = this; + + var rawComponent = arg1$2 => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$().japgolly$scalajs$react$test$emissions$HooksWithChildren$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2); + + var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonPC__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$(), null)); + this.Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$1.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$ }; +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$; + +function $h_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$ }; +$h_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$.prototype; +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$.prototype.japgolly$scalajs$react$test$emissions$HooksWithChildren$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s(function (props) { + _s(); + + var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren.$m_Ljapgolly_scalajs_react_PropsChildren$().fromRawProps__sjs_js_Object__sjs_js_Any(props); + var hook1_raw = $i_react.useState(() => { + $m_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$(); + return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123); + }); + var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); + var sum = ($j_java$002elang$002eObject.$uI(props.a) + $j_java$002elang$002eObject.$uI(hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]) | 0) + $j_japgolly$002escalajs$002ereact$002ePropsChildren.$m_Ljapgolly_scalajs_react_PropsChildren$().count$extension__sjs_js_Any__I(children) | 0; + var $$x1 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((hook1$1 => () => { + $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); + var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(hook1$1); + return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$as_Ljapgolly_scalajs_react_callback_CallbackTo($j_scala$002eFunction1.$as_F1(r.value__O()).apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$1$2 => { + var x$1 = $j_java$002elang$002eObject.$uI(x$1$2); + return 1 + x$1 | 0; + }))).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline); + })(hook1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(children))]; + var this$17 = $$x1.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("button", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); + return $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement.$f_Ljapgolly_scalajs_react_vdom_VdomElement__rawNode__sjs_js_$bar(this$17); +}, "PgpFLcjq+HHAg1XBIX3s6h+EMrQ="); +var $d_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$: 0 +}, false, "japgolly.scalajs.react.test.emissions.HooksWithChildren$", { + Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$ }; +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$; +var $n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$; + +function $m_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$) { + $n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$ = new $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out2.js new file mode 100644 index 000000000..ace1c539c --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out2.js @@ -0,0 +1,110 @@ +'use strict'; + +var _s = $RefreshSig$(); + +import * as $i_react from "react"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusable$0024 from "./japgolly.scalajs.react.Reusable$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2 from "./japgolly.scalajs.react.hooks.HookCtx$P2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF from "./japgolly.scalajs.react.hooks.Hooks$UseStateF.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 from "./japgolly.scalajs.react.internal.Singleton$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024 from "./japgolly.scalajs.react.vdom.Attr$EventCallback$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement from "./japgolly.scalajs.react.vdom.VdomElement.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002eFunction1 from "./scala.Function1.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; +import * as $j_scala$002escalajs$002eruntime$002eWrappedVarArgs from "./scala.scalajs.runtime.WrappedVarArgs.js"; + +function $c_Ljapgolly_scalajs_react_test_emissions_UseState$() { + this.Ljapgolly_scalajs_react_test_emissions_UseState$__f_Component = null; + $n_Ljapgolly_scalajs_react_test_emissions_UseState$ = this; + + var rawComponent = arg1$2 => $m_Ljapgolly_scalajs_react_test_emissions_UseState$().japgolly$scalajs$react$test$emissions$UseState$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2); + + var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$(), null)); + this.Ljapgolly_scalajs_react_test_emissions_UseState$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$1.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_UseState$ }; +$c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_UseState$; + +function $h_Ljapgolly_scalajs_react_test_emissions_UseState$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_UseState$ }; +$h_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype; + +$c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype.japgolly$scalajs$react$test$emissions$UseState$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box = function (props$1, hook1$1) { + return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_java$002elang$002eObject.$uI(props$1.a) + $j_java$002elang$002eObject.$uI(hook1$1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]) | 0); +}; + +$c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype.japgolly$scalajs$react$test$emissions$UseState$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box = function (hook3_ctx$1) { + var $$x3 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); + var $$x2 = $j_java$002elang$002eObject.$uI(hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props); + var this$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1); + var $$x1 = $j_java$002elang$002eObject.$uI(this$1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]); + var this$2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2); + return $$x3.apply__O__Ljapgolly_scalajs_react_internal_Box(($$x2 + $$x1 | 0) + $j_java$002elang$002eObject.$uI(this$2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]) | 0); +}; + +$c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype.japgolly$scalajs$react$test$emissions$UseState$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s(function (props) { + _s(); + + var hook1_raw = $i_react.useState(() => { + $m_Ljapgolly_scalajs_react_test_emissions_UseState$(); + return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123); + }); + var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); + var hook2_raw = $i_react.useState(((props$1, hook1$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_UseState$().japgolly$scalajs$react$test$emissions$UseState$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box(props$1, hook1$1))(props, hook1)); + var hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); + var props$2 = props.a; + var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$2, hook1, hook2); + var hook3_raw = $i_react.useState((hook3_ctx$1 => () => $m_Ljapgolly_scalajs_react_test_emissions_UseState$().japgolly$scalajs$react$test$emissions$UseState$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box(hook3_ctx$1))(hook3_ctx)); + var hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); + var sum = ($j_java$002elang$002eObject.$uI(hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]) + $j_java$002elang$002eObject.$uI(hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]) | 0) + $j_java$002elang$002eObject.$uI(hook3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]) | 0; + var $$x1 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((hook1$2 => () => { + $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); + var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(hook1$2); + return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$as_Ljapgolly_scalajs_react_callback_CallbackTo($j_scala$002eFunction1.$as_F1(r.value__O()).apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$2$2 => { + var x$2 = $j_java$002elang$002eObject.$uI(x$2$2); + return 1 + x$2 | 0; + }))).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline); + })(hook1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]; + var this$15 = $$x1.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("button", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); + return $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement.$f_Ljapgolly_scalajs_react_vdom_VdomElement__rawNode__sjs_js_$bar(this$15); +}, "qo8Jb8XvrnzpV9ZPNQN0hbh5dNs="); +var $d_Ljapgolly_scalajs_react_test_emissions_UseState$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_UseState$: 0 +}, false, "japgolly.scalajs.react.test.emissions.UseState$", { + Ljapgolly_scalajs_react_test_emissions_UseState$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_UseState$ }; +$c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_UseState$; +var $n_Ljapgolly_scalajs_react_test_emissions_UseState$; + +function $m_Ljapgolly_scalajs_react_test_emissions_UseState$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_UseState$) { + $n_Ljapgolly_scalajs_react_test_emissions_UseState$ = new $c_Ljapgolly_scalajs_react_test_emissions_UseState$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_UseState$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_UseState$ }; diff --git a/library/testEmissions/jvm/src/test/resources/sjr/UseState-out2.js b/library/testEmissions/jvm/src/test/resources/sjr/UseState-out2.js deleted file mode 100644 index ee7418a90..000000000 --- a/library/testEmissions/jvm/src/test/resources/sjr/UseState-out2.js +++ /dev/null @@ -1,34 +0,0 @@ -function $c_Lsjr_test_emissions_UseState$() { - this.Lsjr_test_emissions_UseState$__f_Component = null; - $n_Lsjr_test_emissions_UseState$ = this; - var this$1 = $j_sjr_hooks_HookComponentBuilder$ComponentP$SubsequentStep$.$m_Lsjr_hooks_HookComponentBuilder$ComponentP$SubsequentStep$(); - var f = $j_scala_Function1.$as_F1(new $j_sjr_hooks_ComponentP_SubsequentSteps$$anon$1.$c_Lsjr_hooks_ComponentP_SubsequentSteps$$anon$1(this$1).squash__F1().apply__O__O(new $j_AnonFunction2.$c_sjsr_AnonFunction2((x$1$2, s$2) => { - $j_java_lang_Object.$as_jl_Void(x$1$2); - var s = $j_sjr_hooks_Hooks$UseStateF.$as_Lsjr_hooks_Hooks$UseStateF(s$2); - var $$x2 = $j_sjr_vdom_HtmlTagOf$.$m_Lsjr_vdom_HtmlTagOf$(); - $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$(); - $j_sjr_vdom_Exports$.$m_Lsjr_vdom_Exports$(); - $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$(); - $j_sjr_vdom_VdomNode$.$m_Lsjr_vdom_VdomNode$(); - var $$x1 = new $j_sjr_vdom_VdomNode$$anon$1.$c_Lsjr_vdom_VdomNode$$anon$1("Count is "); - $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$(); - var v = $j_java_lang_Object.$uI(s.Lsjr_hooks_Hooks$UseStateF$$anon$2__f_raw[0]); - $j_sjr_vdom_VdomNode$.$m_Lsjr_vdom_VdomNode$(); - var array = [$$x1, new $j_sjr_vdom_VdomNode$$anon$1.$c_Lsjr_vdom_VdomNode$$anon$1(v), $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$().Lsjr_vdom_html_$__f_$up.Lsjr_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Lsjr_vdom_TagMod(new $j_AnonFunction0.$c_sjsr_AnonFunction0((s$1 => () => { - $j_sjr_Reusable$.$m_Lsjr_Reusable$(); - var r = $j_sjr_hooks_Hooks$UseStateF.$f_Lsjr_hooks_Hooks$UseStateF__modState__Lsjr_Reusable(s$1); - return new $j_sjr_callback_CallbackTo.$c_Lsjr_callback_CallbackTo($j_sjr_callback_CallbackTo.$as_Lsjr_callback_CallbackTo($j_scala_Function1.$as_F1(r.value__O()).apply__O__O(new $j_scala_Function1.$c_sjsr_AnonFunction1(x$2$2 => { - var x$2 = $j_java_lang_Object.$uI(x$2$2); - return 1 + x$2 | 0; - }))).Lsjr_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline); - })(s)), $j_sjr_vdom_Attr$EventCallback$.$m_Lsjr_vdom_Attr$EventCallback$().Lsjr_vdom_Attr$EventCallback$__f_defaultSync)]; - return $$x2.apply$extension__T__sci_Seq__Lsjr_vdom_TagOf("button", new $j_WrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); - }))); - $j_sjr_package$.$m_Lsjr_package$(); - var this$17 = $j_sjr_hooks_HookComponentBuilder$.$m_Lsjr_hooks_HookComponentBuilder$().apply__Lsjr_hooks_HookComponentBuilder$ComponentP$First(); - var initialState = new $j_AnonFunction0.$c_sjsr_AnonFunction0(() => 123); - var step = new $j_sjr_hooks_HookComponentBuilder$ComponentP$FirstStep.$c_Lsjr_hooks_HookComponentBuilder$ComponentP$FirstStep(); - this.Lsjr_test_emissions_UseState$__f_Component = $j_sjr_hooks_HookComponentBuilder$ComponentP$Subsequent.$as_Lsjr_hooks_HookComponentBuilder$ComponentP$Subsequent($j_sjr_hooks_Api$Primary.$f_Lsjr_hooks_Api$Primary__useState__F0__Lsjr_hooks_Api$AbstractStep__O(this$17, initialState, step)).render__F1__Lsjr_CtorType$Summoner__Lsjr_component_JsBaseComponentTemplate$ComponentWithRoot(f, $j_sjr_CtorType$Summoner$.$m_Lsjr_CtorType$Summoner$().summonN__Lsjr_internal_Singleton__Lsjr_CtorType$Summoner($j_sjr_internal_Singleton$.$m_Lsjr_internal_Singleton$().Lsjr_internal_Singleton$__f_BoxUnit)); -} - -export { $c_Lsjr_test_emissions_UseState$ }; diff --git a/library/testEmissions/jvm/src/test/resources/sjr/UseState-out3.js b/library/testEmissions/jvm/src/test/resources/sjr/UseState-out3.js deleted file mode 100644 index a927166f4..000000000 --- a/library/testEmissions/jvm/src/test/resources/sjr/UseState-out3.js +++ /dev/null @@ -1,41 +0,0 @@ -function $c_Lsjr_test_emissions_UseState$() { - this.Lsjr_test_emissions_UseState$__f_Component = null; - $n_Lsjr_test_emissions_UseState$ = this; - $j_sjr_package$.$m_Lsjr_package$(); - var this$4 = $j_sjr_hooks_HookComponentBuilder$.$m_Lsjr_hooks_HookComponentBuilder$().apply__Lsjr_hooks_HookComponentBuilder$ComponentP$First(); - var initialState = new $j_AnonFunction0.$c_sjsr_AnonFunction0(() => 123); - var step = new $j_sjr_hooks_HookComponentBuilder$ComponentP$FirstStep.$c_Lsjr_hooks_HookComponentBuilder$ComponentP$FirstStep(); - var ApiSecondaryWithRenderMacros_this = $j_sjr_hooks_HookComponentBuilder$ComponentP$Subsequent.$as_Lsjr_hooks_HookComponentBuilder$ComponentP$Subsequent($j_sjr_hooks_Api$Primary.$f_Lsjr_hooks_Api$Primary__useState__F0__Lsjr_hooks_Api$AbstractStep__O(this$4, initialState, step)); - this.Lsjr_test_emissions_UseState$__f_Component = ApiSecondaryWithRenderMacros_this.render__F1__Lsjr_CtorType$Summoner__Lsjr_component_JsBaseComponentTemplate$ComponentWithRoot(new $j_scala_Function1.$c_sjsr_AnonFunction1(_$4 => { - var _$4$1 = $j_sjr_hooks_HookCtx$P1.$as_Lsjr_hooks_HookCtx$P1(_$4); - - return $j_sjr_vdom_VdomNode.$as_Lsjr_vdom_VdomNode($j_scala_Function1.$as_F1(new $j_sjr_hooks_ComponentP_SubsequentSteps$$anon$1.$c_Lsjr_hooks_ComponentP_SubsequentSteps$$anon$1().squash__F1().apply__O__O(new $j_AnonFunction2.$c_sjsr_AnonFunction2((_$1, s) => { - $j_java_lang_Object.$as_jl_Void(_$1); - var s$1 = $j_sjr_hooks_Hooks$UseStateF.$as_Lsjr_hooks_Hooks$UseStateF(s); - var this$16 = $j_sjr_vdom_HtmlTagOf$.$m_Lsjr_vdom_HtmlTagOf$(); - $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$(); - $j_sjr_vdom_Exports$.$m_Lsjr_vdom_Exports$(); - var self = "button"; - var $$x2 = $j_java_lang_Character$.$m_sr_ScalaRunTime$(); - $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$(); - $j_sjr_vdom_VdomNode$.$m_Lsjr_vdom_VdomNode$(); - var $$x1 = new $j_sjr_vdom_VdomNode$$anon$1.$c_Lsjr_vdom_VdomNode$$anon$1("Count is "); - $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$(); - var v = $j_java_lang_Object.$uI(s$1.Lsjr_hooks_Hooks$$anon$2__f_raw[0]); - $j_sjr_vdom_VdomNode$.$m_Lsjr_vdom_VdomNode$(); - var xs = $$x2.wrapRefArray__AO__sci_ArraySeq(new ($j_sjr_vdom_TagMod.$d_Lsjr_vdom_TagMod.getArrayOf().constr)([$$x1, new $j_sjr_vdom_VdomNode$$anon$1.$c_Lsjr_vdom_VdomNode$$anon$1(v), $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$().Lsjr_vdom_html_$__f_$up.Lsjr_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Lsjr_vdom_TagMod(new $j_AnonFunction0.$c_sjsr_AnonFunction0((s$2 => () => { - $j_sjr_Reusable$.$m_Lsjr_Reusable$(); - var r = $j_sjr_hooks_Hooks$UseStateF.$f_Lsjr_hooks_Hooks$UseStateF__modState__Lsjr_Reusable(s$2); - var ev$1 = $j_scala_Function1.$as_F1(r.value__O()).apply__O__O(new $j_scala_Function1.$c_sjsr_AnonFunction1(_$2 => { - var _$2$1 = $j_java_lang_Object.$uI(_$2); - - return 1 + _$2$1 | 0; - })); - return new $j_sjr_callback_CallbackTo.$c_Lsjr_callback_CallbackTo(ev$1 === null ? null : $j_sjr_callback_CallbackTo.$as_Lsjr_callback_CallbackTo(ev$1).Lsjr_callback_CallbackTo__f_trampoline); - })(s$1)), $j_sjr_vdom_Attr$EventCallback$.$m_Lsjr_vdom_Attr$EventCallback$().Lsjr_vdom_Attr$EventCallback$__f_defaultSync)])); - return $j_sjr_vdom_TagLite.$f_Lsjr_vdom_TagLite__apply__T__sci_Seq__Lsjr_vdom_TagOf(this$16, self, xs); - }))).apply__O__O(_$4$1)); - }), $j_sjr_CtorType$Summoner$.$m_Lsjr_CtorType$Summoner$().summonN__Lsjr_internal_Singleton__Lsjr_CtorType$Summoner($j_sjr_internal_Singleton$.$m_Lsjr_internal_Singleton$().Lsjr_internal_Singleton$__f_BoxUnit)); -} - -export { $c_Lsjr_test_emissions_UseState$ }; diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/EmissionTest.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/EmissionTest.scala index 67c479ea3..1991221e9 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/EmissionTest.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/EmissionTest.scala @@ -9,10 +9,10 @@ object EmissionTest extends TestSuite { override def tests = Tests { - "UseState" - testScala(hack = TestJs.Hack { _ - .dropLinesUntil(_ endsWith " = function (props) {") - .takeLinesTo(_ == "};") - }, golden = false) + // "UseState" - testScala(hack = TestJs.Hack { _ + // .dropLinesUntil(_ endsWith " = function (props) {") + // .takeLinesTo(_ == "};") + // }.disable, golden = false) } diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala index df62368ce..e3de34f93 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala @@ -2,6 +2,7 @@ package japgolly.scalajs.react.test.emissions import japgolly.microlibs.utils.FileUtils import japgolly.scalajs.react.test.emissions.util._ +import japgolly.univeq._ import scala.annotation.nowarn import scala.util.Try import utest._ @@ -12,11 +13,16 @@ object ReactRefreshTest extends TestSuite { override def tests = Tests { "js" - { - "demo" - testJs() + "fn" - testJs() + "hooks" - testJs() // "temp" - testJs() } - // "UseState" - showScala() + "sjr" - { + "HooksWithChildren" - testScala() + "NoHooksWithChildren" - showScala() + "UseState" - testScala() + } } // =================================================================================================================== @@ -44,8 +50,8 @@ object ReactRefreshTest extends TestSuite { protected def showScala(assertRR : Boolean = false, assertNoRR : Boolean = false, assertBabelChanges: Boolean = false, - showPreBabel : Boolean = true, - showResult : Boolean = false, + showPreBabel : Boolean = false, + showResult : Boolean = true, showDiff : Boolean = true, golden : Boolean = false, hack : TestJs.Hack = null, @@ -137,7 +143,7 @@ object ReactRefreshTest extends TestSuite { Util.debugShowContent(s"$name.scala JS pre-babel", before, "\u001b[107;30m", rrFlags = false) if (showResult) Util.debugShowContent(s"$name.scala JS post-babel", after, "\u001b[107;30m") - if (showDiff) + if (showDiff && (before !=* after)) Util.debugShowDiff(before, after) } diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Babel.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Babel.scala index 618f069c0..59b469d83 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Babel.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Babel.scala @@ -62,8 +62,14 @@ object Babel { private def useCfgNorm = "--config-file=./babel.norm.json" def normaliseToStr(srcFilename: String): String = - Node.babel(srcFilename, useCfgNorm) + if (Util.exists(srcFilename)) + Node.babel(srcFilename, useCfgNorm) + else + throw new RuntimeException("File not found: " + srcFilename) def normaliseToFile(srcFilename: String, tgtFilename: String): Unit = - Node.babel(srcFilename, useCfgNorm, "-o", tgtFilename) + if (Util.exists(srcFilename)) + Node.babel(srcFilename, useCfgNorm, "-o", tgtFilename) + else + throw new RuntimeException("File not found: " + srcFilename) } diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala index 408179ded..8d14045c2 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala @@ -35,7 +35,7 @@ object TestJs { val humanReadable: Hack = { // Lines that simply initialise object singletons - val objectInit = """^ *(?:\$j_[a-zA-Z_]+\$\.)?\$m_[a-zA-Z_]+\$\(\);$""".r + val objectInit = """^ *(?:\$j_[a-zA-Z0-9_]+\$\.)?\$m_[a-zA-Z0-9_]+\$\(\); *$""".r apply(_ .modifyLines(_ diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Util.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Util.scala index 3182f694a..ff9840349 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Util.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Util.scala @@ -30,7 +30,7 @@ object Util { def debugShowContent(name: String, content: String, colour: String, rrFlags: Boolean = true): Unit = { val batPath = "/usr/bin/bat" - var useBat = (new File(batPath)).exists() + var useBat = exists(batPath) val rrDesc = if (rrFlags) { @@ -83,7 +83,7 @@ object Util { def debugShowDiff(content1: String, content2: String): Unit = { var diffPath = "/usr/bin/colordiff" - if (!(new File(diffPath)).exists()) + if (!exists(diffPath)) diffPath = "diff" val file1 = writeToTempFile("")(content1) @@ -95,6 +95,9 @@ object Util { println(sep) } + def exists(filename: String): Boolean = + (new File(filename)).exists() + def getFileContent(path: String): Option[String] = { val f = new File(path) Option.when(f.exists())(readSource(Source.fromFile(f))) From bee71507577905632f54faed51ee01f65c74c7fe Mon Sep 17 00:00:00 2001 From: David Barri Date: Tue, 7 Jun 2022 08:04:34 +1000 Subject: [PATCH 12/72] Fix formatting --- library/project/Dependencies.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/project/Dependencies.scala b/library/project/Dependencies.scala index 62a74483a..3587834ae 100644 --- a/library/project/Dependencies.scala +++ b/library/project/Dependencies.scala @@ -47,7 +47,7 @@ object Dependencies { val microlibsCompileTime = Def.setting("com.github.japgolly.microlibs" %%% "compile-time" % Ver.microlibs) val microlibsTestUtil = Def.setting("com.github.japgolly.microlibs" %%% "test-util" % Ver.microlibs) val microlibsTypes = Def.setting("com.github.japgolly.microlibs" %%% "types" % Ver.microlibs) - val microlibsUtils = Def.setting("com.github.japgolly.microlibs" %%% "utils" % Ver.microlibs) + val microlibsUtils = Def.setting("com.github.japgolly.microlibs" %%% "utils" % Ver.microlibs) val monocle2 = Def.setting("com.github.julien-truffaut" %%% "monocle-core" % Ver.monocle2 cross CrossVersion.for3Use2_13 excludeAll(ExclusionRule(organization = "org.typelevel"))) val monocle3 = Def.setting("dev.optics" %%% "monocle-core" % Ver.monocle3) val nyayaGen = Def.setting("com.github.japgolly.nyaya" %%% "nyaya-gen" % Ver.nyaya) From ff104a44397a51c40f7e89c4251986a217fdd041 Mon Sep 17 00:00:00 2001 From: David Barri Date: Tue, 7 Jun 2022 08:05:47 +1000 Subject: [PATCH 13/72] Add TODO --- library/TODO.md | 83 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 library/TODO.md diff --git a/library/TODO.md b/library/TODO.md new file mode 100644 index 000000000..0aa82068d --- /dev/null +++ b/library/TODO.md @@ -0,0 +1,83 @@ +```scala +// HookComponentBuilder.scala +/* [--] */ def withPropsChildren: ComponentPC.First[P] +/* [--] */ def render(f: (P, PropsChildren) => VdomNode)(implicit s: CtorType.Summoner[Box[P], Children.Varargs]): Component[P, s.CT] +/* [--] */ def render in primary API + +// Api.scala +/* [--] */ def custom [I, O](hook: CustomHook[I, O])(implicit step: Step, a: CustomHook.Arg[Ctx, I], d: DynamicNextStep[O]): d.OneOf[step.Self, step.Next[O]] +/* [--] */ def customBy [O](hook: Ctx => CustomHook[Unit, O])(implicit step: Step, d: DynamicNextStep[O]): d.OneOf[step.Self, step.Next[O]] +/* [--] */ def customBy [O](hook: CtxFn[CustomHook[Unit, O]])(implicit step: Step, d: DynamicNextStep[O]): d.OneOf[step.Self, step.Next[O]] +/* [--] */ def localLazyVal [A](a: => A)(implicit step: Step): step.Next[() => A] +/* [--] */ def localLazyValBy [A](f: Ctx => A)(implicit step: Step): step.Next[() => A] +/* [--] */ def localLazyValBy [A](f: CtxFn[A])(implicit step: Step): step.Next[() => A] +/* [--] */ def localVal [A](a: => A)(implicit step: Step): step.Next[A] +/* [--] */ def localValBy [A](f: Ctx => A)(implicit step: Step): step.Next[A] +/* [--] */ def localValBy [A](f: CtxFn[A])(implicit step: Step): step.Next[A] +/* [--] */ def localVar [A](a: => A)(implicit step: Step): step.Next[Var[A]] +/* [--] */ def localVarBy [A](f: Ctx => A)(implicit step: Step): step.Next[Var[A]] +/* [--] */ def localVarBy [A](f: CtxFn[A])(implicit step: Step): step.Next[Var[A]] +/* [2-] */ def render (f: Ctx => VdomNode)(implicit s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] +/* [--] */ def renderReusable [A](f: Ctx => Reusable[A])(implicit s: CtorType.Summoner[Box[P], C], v: A => VdomNode): Component[P, s.CT] +/* [--] */ def renderReusable [A](f: CtxFn[Reusable[A]])(implicit step: Step, s: CtorType.Summoner[Box[P], C], v: A => VdomNode): Component[P, s.CT] +/* [--] */ def renderWithReuse (f: Ctx => VdomNode)(implicit s: CtorType.Summoner[Box[P], C], r: Reusability[Ctx]): Component[P, s.CT] +/* [--] */ def renderWithReuse (f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C], r: Reusability[Ctx]): Component[P, s.CT] +/* [--] */ def renderWithReuseBy [A](reusableInputs: Ctx => A)(f: A => VdomNode)(implicit s: CtorType.Summoner[Box[P], C], r: Reusability[A]): Component[P, s.CT] +/* [--] */ def renderWithReuseBy [A](reusableInputs: CtxFn[A])(f: A => VdomNode)(implicit step: Step, s: CtorType.Summoner[Box[P], C], r: Reusability[A]): Component[P, s.CT] +/* [--] */ def unchecked [A](f: => A)(implicit step: Step, d: DynamicNextStep[A]): d.OneOf[step.Self, step.Next[A]] +/* [--] */ def uncheckedBy [A](f: Ctx => A)(implicit step: Step, d: DynamicNextStep[A]): d.OneOf[step.Self, step.Next[A]] +/* [--] */ def uncheckedBy [A](f: CtxFn[A])(implicit step: Step, d: DynamicNextStep[A]): d.OneOf[step.Self, step.Next[A]] +/* [--] */ def useCallback [A](callback: A)(implicit a: UseCallbackArg[A], step: Step): step.Next[Reusable[A]] +/* [--] */ def useCallbackBy [A](callback: Ctx => A)(implicit a: UseCallbackArg[A], step: Step): step.Next[Reusable[A]] +/* [--] */ def useCallbackBy [A](callback: CtxFn[A])(implicit a: UseCallbackArg[A], step: Step): step.Next[Reusable[A]] +/* [--] */ def useCallbackWithDeps [D, A](deps: => D)(callback: D => A)(implicit a: UseCallbackArg[A], r: Reusability[D], step: Step): step.Next[Reusable[A]] +/* [--] */ def useCallbackWithDepsBy [D, A](deps: Ctx => D)(callback: Ctx => D => A)(implicit a: UseCallbackArg[A], r: Reusability[D], step: Step): step.Next[Reusable[A]] +/* [--] */ def useCallbackWithDepsBy [D, A](deps: CtxFn[D])(callback: CtxFn[D => A])(implicit a: UseCallbackArg[A], r: Reusability[D], step: Step): step.Next[Reusable[A]] +/* [--] */ def useContext [A](ctx: Context[A])(implicit step: Step): step.Next[A] +/* [--] */ def useContextBy [A](f: Ctx => Context[A])(implicit step: Step): step.Next[A] +/* [--] */ def useContextBy [A](f: CtxFn[Context[A]])(implicit step: Step): step.Next[A] +/* [--] */ def useDebugValue (desc: => Any)(implicit step: Step): step.Self +/* [--] */ def useDebugValueBy (desc: Ctx => Any)(implicit step: Step): step.Self +/* [--] */ def useDebugValueBy (f: CtxFn[Any])(implicit step: Step): step.Self +/* [--] */ def useEffect [A](effect: A)(implicit a: UseEffectArg[A], step: Step): step.Self +/* [--] */ def useEffectBy [A](init: Ctx => A)(implicit a: UseEffectArg[A], step: Step): step.Self +/* [--] */ def useEffectBy [A](init: CtxFn[A])(implicit a: UseEffectArg[A], step: Step): step.Self +/* [--] */ def useEffectOnMount [A](effect: A)(implicit a: UseEffectArg[A], step: Step): step.Self +/* [--] */ def useEffectOnMountBy [A](effect: Ctx => A)(implicit a: UseEffectArg[A], step: Step): step.Self +/* [--] */ def useEffectOnMountBy [A](effect: CtxFn[A])(implicit a: UseEffectArg[A], step: Step): step.Self +/* [--] */ def useEffectWithDeps [D, A](deps: => D)(effect: D => A)(implicit a: UseEffectArg[A], r: Reusability[D], step: Step): step.Self +/* [--] */ def useEffectWithDepsBy [D, A](deps: Ctx => D)(effect: Ctx => D => A)(implicit a: UseEffectArg[A], r: Reusability[D], step: Step): step.Self +/* [--] */ def useEffectWithDepsBy [D, A](deps: CtxFn[D])(effect: CtxFn[D => A])(implicit a: UseEffectArg[A], r: Reusability[D], step: Step): step.Self +/* [--] */ def useForceUpdate (implicit step: Step): step.Next[Reusable[DefaultEffects.Sync[Unit]]] +/* [--] */ def useLayoutEffect [A](effect: A)(implicit a: UseEffectArg[A], step: Step): step.Self +/* [--] */ def useLayoutEffectBy [A](init: Ctx => A)(implicit a: UseEffectArg[A], step: Step): step.Self +/* [--] */ def useLayoutEffectBy [A](init: CtxFn[A])(implicit a: UseEffectArg[A], step: Step): step.Self +/* [--] */ def useLayoutEffectOnMount [A](effect: A)(implicit a: UseEffectArg[A], step: Step): step.Self +/* [--] */ def useLayoutEffectOnMountBy [A](effect: Ctx => A)(implicit a: UseEffectArg[A], step: Step): step.Self +/* [--] */ def useLayoutEffectOnMountBy [A](effect: CtxFn[A])(implicit a: UseEffectArg[A], step: Step): step.Self +/* [--] */ def useLayoutEffectWithDeps [D, A](deps: => D)(effect: D => A)(implicit a: UseEffectArg[A], r: Reusability[D], step: Step): step.Self +/* [--] */ def useLayoutEffectWithDepsBy [D, A](deps: Ctx => D)(effect: Ctx => D => A)(implicit a: UseEffectArg[A], r: Reusability[D], step: Step): step.Self +/* [--] */ def useLayoutEffectWithDepsBy [D, A](deps: CtxFn[D])(effect: CtxFn[D => A])(implicit a: UseEffectArg[A], r: Reusability[D], step: Step): step.Self +/* [--] */ def useMemo [D, A](deps: => D)(create: D => A)(implicit r: Reusability[D], step: Step): step.Next[Reusable[A]] +/* [--] */ def useMemoBy [D, A](deps: Ctx => D)(create: Ctx => D => A)(implicit r: Reusability[D], step: Step): step.Next[Reusable[A]] +/* [--] */ def useMemoBy [D, A](deps: CtxFn[D])(create: CtxFn[D => A])(implicit r: Reusability[D], step: Step): step.Next[Reusable[A]] +/* [--] */ def useReducer [S, A](reducer: (S, A) => S, initialState: => S)(implicit step: Step): step.Next[UseReducer[S, A]] +/* [--] */ def useReducerBy [S, A](reducer: Ctx => (S, A) => S, initialState: Ctx => S)(implicit step: Step): step.Next[UseReducer[S, A]] +/* [--] */ def useReducerBy [S, A](reducer: CtxFn[(S, A) => S], initialState: CtxFn[S])(implicit step: Step): step.Next[UseReducer[S, A]] +/* [--] */ def useRef [A](initialValue: => A)(implicit step: Step): step.Next[UseRef[A]] +/* [--] */ def useRefBy [A](f: CtxFn[A])(implicit step: Step): step.Next[UseRef[A]] +/* [--] */ def useRefBy [A](initialValue: Ctx => A)(implicit step: Step): step.Next[UseRef[A]] +/* [--] */ def useRefToAnyVdom (implicit step: Step): step.Next[Ref.ToAnyVdom] +/* [--] */ def useRefToJsComponent [F[_], A[_], P1, S1, CT1[-p, +u] <: CtorType[p, u], R <: JsComponent.RawMounted[P0, S0], P0 <: js.Object, S0 <: js.Object, CT0[-p, +u] <: CtorType[p, u +/* [--] */ def useRefToJsComponent [P <: js.Object, S <: js.Object](implicit step: Step): step.Next[Ref.ToJsComponent[P, S, JsComponent.RawMounted[P, S]]] +/* [--] */ def useRefToJsComponentWithMountedFacade[P <: js.Object, S <: js.Object, F <: js.Object](implicit step: Step): step.Next[Ref.ToJsComponent[P, S, JsComponent.RawMounted[P, S] with F]] +/* [--] */ def useRefToScalaComponent [P, S, B, CT[-p, +u] <: CtorType[p, u +/* [--] */ def useRefToScalaComponent [P, S, B](implicit step: Step): step.Next[Ref.ToScalaComponent[P, S, B]] +/* [--] */ def useRefToVdom [N <: TopNode: ClassTag](implicit step: Step): step.Next[Ref.ToVdom[N]] +/* [2-] */ def useState [S](initialState: => S)(implicit step: Step): step.Next[UseState[S]] +/* [2-] */ def useStateBy [S](initialState: Ctx => S)(implicit step: Step): step.Next[UseState[S]] +/* [2-] */ def useStateBy [S](initialState: CtxFn[S])(implicit step: Step): step.Next[UseState[S]] +/* [--] */ def useStateWithReuse [S: ClassTag: Reusability](initialState: => S)(implicit step: Step): step.Next[UseStateWithReuse[S]] +/* [--] */ def useStateWithReuseBy [S: ClassTag: Reusability](initialState: Ctx => S)(implicit step: Step): step.Next[UseStateWithReuse[S]] +/* [--] */ def useStateWithReuseBy [S: ClassTag: Reusability](initialState: CtxFn[S])(implicit step: Step): step.Next[UseStateWithReuse[S]] +``` From 008744e1850445aef9fe8ba91883f1c3ba4d9b70 Mon Sep 17 00:00:00 2001 From: David Barri Date: Tue, 7 Jun 2022 08:06:53 +1000 Subject: [PATCH 14/72] Remove NoHooksWithChildren for now --- .../scalajs/react/test/emissions/Main.scala | 1 - .../react/test/emissions/NoHooksWithChildren.scala | 14 -------------- .../react/test/emissions/ReactRefreshTest.scala | 1 - 3 files changed, 16 deletions(-) delete mode 100644 library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/NoHooksWithChildren.scala diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala index f4d324aaf..98e13edaf 100644 --- a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala @@ -15,7 +15,6 @@ object Main { private val Component = ScalaFnComponent[Unit] { _ => <.div( HooksWithChildren.Component(0)(<.div), - NoHooksWithChildren.Component(0)(<.div), UseState.Component(0), ) } diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/NoHooksWithChildren.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/NoHooksWithChildren.scala deleted file mode 100644 index 38090e67b..000000000 --- a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/NoHooksWithChildren.scala +++ /dev/null @@ -1,14 +0,0 @@ -package japgolly.scalajs.react.test.emissions - -import japgolly.scalajs.react._ -import japgolly.scalajs.react.vdom.html_<^._ - -object NoHooksWithChildren { - - val Component = ScalaFnComponent.withHooks[Int] - .withPropsChildren - .render { (p, c) => - val sum = p + c.count - <.div("DEBUG = ", sum) - } -} diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala index e3de34f93..825f66841 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala @@ -20,7 +20,6 @@ object ReactRefreshTest extends TestSuite { "sjr" - { "HooksWithChildren" - testScala() - "NoHooksWithChildren" - showScala() "UseState" - testScala() } } From d2e6f64b3317f9488d8c942a8f539a5ca20f3836 Mon Sep 17 00:00:00 2001 From: David Barri Date: Tue, 7 Jun 2022 08:28:24 +1000 Subject: [PATCH 15/72] Fix and harden ReactRefreshTest --- .../react/test/emissions/EmissionTest.scala | 8 ++++++-- .../react/test/emissions/ReactRefreshTest.scala | 7 +++++-- .../react/test/emissions/util/Babel.scala | 13 +++++++++++-- .../react/test/emissions/util/TestJs.scala | 9 +++++++++ .../scalajs/react/test/emissions/util/Util.scala | 16 ++++++++-------- 5 files changed, 39 insertions(+), 14 deletions(-) diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/EmissionTest.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/EmissionTest.scala index 1991221e9..864a6dc92 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/EmissionTest.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/EmissionTest.scala @@ -23,6 +23,7 @@ object EmissionTest extends TestSuite { golden : Boolean = true, normalise : Boolean = true, hack : TestJs.Hack = null, + onCmp : TestJs.Hack = TestJs.Hack.forComparison, expectedFrags: Seq[String] = Seq.empty) (implicit tp : TestPath) = { @@ -58,9 +59,12 @@ object EmissionTest extends TestSuite { assertContainsAll(actual, expectedFrags: _*) if (golden) - Util.useOrCreateFile(expectFilename, actual, assertMultiline(actual, _)) match { + Util.readOrCreateFile(expectFilename, actual) match { case None => utestOutput = s"Created $expectFilename" - case Some(_) => + case Some(e) => + val actual2 = onCmp.runAnon(actual).content + val expect2 = onCmp.runAnon(e).content + assertMultiline(actual2, expect2) } } finally { diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala index 825f66841..a086113f7 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala @@ -1,8 +1,8 @@ package japgolly.scalajs.react.test.emissions +import japgolly.microlibs.testutil.TestUtil._ import japgolly.microlibs.utils.FileUtils import japgolly.scalajs.react.test.emissions.util._ -import japgolly.univeq._ import scala.annotation.nowarn import scala.util.Try import utest._ @@ -54,6 +54,7 @@ object ReactRefreshTest extends TestSuite { showDiff : Boolean = true, golden : Boolean = false, hack : TestJs.Hack = null, + onCmp : TestJs.Hack = TestJs.Hack.forComparison, onShow : TestJs.Hack = TestJs.Hack.humanReadable, expectedFrags : Seq[String] = Seq.empty) (implicit tp : TestPath) = @@ -66,6 +67,7 @@ object ReactRefreshTest extends TestSuite { showDiff = showDiff, golden = false, hack = hack, + onCmp = onCmp, onShow = onShow, expectedFrags = expectedFrags, ) @@ -79,6 +81,7 @@ object ReactRefreshTest extends TestSuite { showDiff : Boolean = false, golden : Boolean = true, hack : TestJs.Hack = null, + onCmp : TestJs.Hack = TestJs.Hack.forComparison, onShow : TestJs.Hack = TestJs.Hack.humanReadable, expectedFrags : Seq[String] = Seq.empty) (implicit tp : TestPath) = { @@ -124,7 +127,7 @@ object ReactRefreshTest extends TestSuite { babel.assertOutputContains(expectedFrags: _*) if (golden) - utestOutput = babel.assertOrSaveOutput(expectFilename) + utestOutput = babel.assertOrSaveOutput(expectFilename, onCmp) if (utestOutput == ()) reactRefreshSignature(babel.after) match { diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Babel.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Babel.scala index 59b469d83..d32025f72 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Babel.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Babel.scala @@ -36,9 +36,18 @@ final case class Babel(before : String, Util.debugShowContent(s"$beforeFilename ", after, "\u001b[43;30m") def assertOrSaveOutput(filename: String)(implicit l: Line): Any = - Util.useOrCreateFile(filename, after, assertOutput(_)) match { + Util.readOrCreateFile(filename, after) match { case None => s"Created $filename" - case Some(_) => () + case Some(s) => assertOutput(s) + } + + def assertOrSaveOutput(filename: String, preCmpHack: TestJs.Hack)(implicit l: Line): Any = + Util.readOrCreateFile(filename, after) match { + case None => s"Created $filename" + case Some(e) => + val actual = preCmpHack.runAnon(after).content + val expect = preCmpHack.runAnon(e).content + assertMultiline(actual, expect) } } diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala index 8d14045c2..388504625 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala @@ -51,5 +51,14 @@ object TestJs { .filterNot(objectInit) ) } + + // Hacks to apply before comparison, so that tests consitently pass + val comparisonHacks: Hack = + apply(_.modify(_ + .replace("PropsChildren$", "PropsChildren") // Not sure why SJS sometimes emits one or the other + )) + + val forComparison: Hack = + humanReadable >> comparisonHacks } } diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Util.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Util.scala index ff9840349..4906d2b27 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Util.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Util.scala @@ -113,12 +113,7 @@ object Util { } } - private def readSource(src: => Source): String = { - val s = src - try s.mkString finally s.close() - } - - def useOrCreateFile[A](filename: String, create: => String, use: String => A): Option[A] = + def readOrCreateFile[A](filename: String, create: => String): Option[String] = getFileContent(filename) match { // If no file exists, create it @@ -130,10 +125,15 @@ object Util { None // File exists - case Some(s) => - Some(use(s)) + case s@ Some(_) => + s } + private def readSource(src: => Source): String = { + val s = src + try s.mkString finally s.close() + } + def writeToTempFile(fileSuffix: String)(content: String): String = { val p = Files.createTempFile("sjr-emissions-", fileSuffix) val f = p.toFile() From 656a963379e9f8458f097e0a8812f5ab7e0ed051 Mon Sep 17 00:00:00 2001 From: David Barri Date: Tue, 7 Jun 2022 09:06:27 +1000 Subject: [PATCH 16/72] Rewrite `useStateWithReuse{,By}` --- library/TODO.md | 6 +- .../scalajs/react/hooks/HookMacros.scala | 59 +++++--- .../japgolly/scalajs/react/hooks/Hooks.scala | 17 ++- .../scalajs/react/test/emissions/Main.scala | 1 + .../test/emissions/UseStateWithReuse.scala | 19 +++ .../rr-sjr/UseStateWithReuse-out2.js | 135 ++++++++++++++++++ .../test/emissions/ReactRefreshTest.scala | 1 + .../react/test/emissions/util/TestJs.scala | 11 +- 8 files changed, 217 insertions(+), 32 deletions(-) create mode 100644 library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseStateWithReuse.scala create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out2.js diff --git a/library/TODO.md b/library/TODO.md index 0aa82068d..328075931 100644 --- a/library/TODO.md +++ b/library/TODO.md @@ -77,7 +77,7 @@ /* [2-] */ def useState [S](initialState: => S)(implicit step: Step): step.Next[UseState[S]] /* [2-] */ def useStateBy [S](initialState: Ctx => S)(implicit step: Step): step.Next[UseState[S]] /* [2-] */ def useStateBy [S](initialState: CtxFn[S])(implicit step: Step): step.Next[UseState[S]] -/* [--] */ def useStateWithReuse [S: ClassTag: Reusability](initialState: => S)(implicit step: Step): step.Next[UseStateWithReuse[S]] -/* [--] */ def useStateWithReuseBy [S: ClassTag: Reusability](initialState: Ctx => S)(implicit step: Step): step.Next[UseStateWithReuse[S]] -/* [--] */ def useStateWithReuseBy [S: ClassTag: Reusability](initialState: CtxFn[S])(implicit step: Step): step.Next[UseStateWithReuse[S]] +/* [2-] */ def useStateWithReuse [S: ClassTag: Reusability](initialState: => S)(implicit step: Step): step.Next[UseStateWithReuse[S]] +/* [2-] */ def useStateWithReuseBy [S: ClassTag: Reusability](initialState: Ctx => S)(implicit step: Step): step.Next[UseStateWithReuse[S]] +/* [2-] */ def useStateWithReuseBy [S: ClassTag: Reusability](initialState: CtxFn[S])(implicit step: Step): step.Next[UseStateWithReuse[S]] ``` diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala index 69ab581e2..94224f754 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -185,6 +185,27 @@ class HookMacros(val c: Context) extends MacroUtils { private def inlineHookStep(step: HookStep)(implicit log: MacroLogger): Either[() => String, HookRewriter => TermName] = { log("inlineHookStep." + step.name, step) + def by[A](fn: Tree)(use: (HookRewriter, Tree) => A): Either[() => String, HookRewriter => A] = + fn match { + case f@ Function(params, _) => + Right { b => + if (params.sizeIs == 1) { + val ctxArg = b.ctxArg() + use(b, call(f, ctxArg :: Nil)) + } else + use(b, call(f, b.args())) + } + + case _ => + Left(() => s"Expected a function, found: ${showRaw(fn)}") + } + + def maybeBy[A](f: Tree)(use: (HookRewriter, Tree) => A): Either[() => String, HookRewriter => A] = + if (step.name endsWith "By") + by(f)(use) + else + Right(use(_, f)) + def useState(b: HookRewriter, tpe: Tree, body: Tree) = { val rawName = b.nextHookName("_raw") val name = b.nextHookName() @@ -193,29 +214,25 @@ class HookMacros(val c: Context) extends MacroUtils { name } + def useStateWithReuse(b: HookRewriter, tpe: Tree, body: Tree, reuse: Tree, ct: Tree) = { + val rawName = b.nextHookName("_raw") + val name = b.nextHookName() + b += q"val $rawName = $React.useStateFn(() => $Box[$tpe]($body))" + b += q"val $name = $Hooks.UseStateWithReuse.fromJsBoxed[$tpe]($rawName)($reuse, $ct)" + name + } + step.name match { - case "useState" => - val targ = step.targs.head - val arg = step.args.head.head - Right(useState(_, targ, arg)) - - case "useStateBy" => - val targ = step.targs.head - val arg = step.args.head.head - arg match { - case f@ Function(params, _) => - if (params.sizeIs == 1) - Right { b => - val ctxArg = b.ctxArg() - useState(b, targ, call(f, ctxArg :: Nil)) - } - else - Right(b => useState(b, targ, call(f, b.args()))) + case "useState" | "useStateBy" => + val List(tpe) = step.targs : @nowarn + val List(List(f), _) = step.args : @nowarn + maybeBy(f)(useState(_, tpe, _)) - case _ => - Left(() => s"Expected a function, found: ${showRaw(arg)}") - } + case "useStateWithReuse" | "useStateWithReuseBy" => + val List(tpe) = step.targs : @nowarn + val List(List(f), List(ct, reuse, _)) = step.args : @nowarn + maybeBy(f)(useStateWithReuse(_, tpe, _, reuse, ct)) case _ => Left(() => s"Inlining of hook method '${step.name}' not yet supported.") @@ -226,7 +243,7 @@ class HookMacros(val c: Context) extends MacroUtils { log("inlineHookRender." + step.name, step) step.name match { case "render" => - @nowarn("msg=exhaustive") val List(List(renderFn), _) = step.args + val List(List(renderFn), _) = step.args : @nowarn Right(b => call(renderFn, b.args())) case _ => diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Hooks.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Hooks.scala index 0efa2745f..9f505c7d4 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Hooks.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Hooks.scala @@ -247,13 +247,16 @@ object Hooks { @inline def apply[S, O](r: facade.React.UseState[S], oss: Reusable[facade.React.UseStateSetter[O]]): UseState[S] = UseStateF(r, oss)(D.Sync) - def unsafeCreate[S](initialState: => S): UseState[S] = { + def unsafeCreateJsBoxed[S](initialState: => S): facade.React.UseState[Box[S]] = { // Boxing is required because React's useState uses reflection to distinguish between {set,mod}State. - val initialStateFn = (() => Box(initialState)): js.Function0[Box[S]] - val originalResult = facade.React.useStateFn[Box[S]](initialStateFn) - fromJsBoxed(originalResult) + facade.React.useStateFn[Box[S]]( + (() => Box(initialState)): js.Function0[Box[S]] + ) } + def unsafeCreate[S](initialState: => S): UseState[S] = + fromJsBoxed(unsafeCreateJsBoxed(initialState)) + def fromJsBoxed[S](r: facade.React.UseState[Box[S]]): UseState[S] = { val originalSetState = Reusable.byRef(r._2) UseState(r, originalSetState).xmap(_.unbox)(Box.apply) @@ -373,6 +376,12 @@ object Hooks { val us = UseState.unsafeCreate(initialState).withReusability UseStateWithReuseF(us, rr) } + + def fromJsBoxed[S](raw: facade.React.UseState[Box[S]])(implicit r: Reusability[S], ct: ClassTag[S]): UseStateWithReuse[S] = { + val rr = Reusable.reusabilityInstance(r) + val us = UseState.fromJsBoxed(raw).withReusability + UseStateWithReuseF(us, rr) + } } type UseStateWithReuse[S] = UseStateWithReuseF[D.Sync, S] diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala index 98e13edaf..e6263a6df 100644 --- a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala @@ -16,6 +16,7 @@ object Main { <.div( HooksWithChildren.Component(0)(<.div), UseState.Component(0), + UseStateWithReuse.Component(0), ) } } diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseStateWithReuse.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseStateWithReuse.scala new file mode 100644 index 000000000..f5445761f --- /dev/null +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseStateWithReuse.scala @@ -0,0 +1,19 @@ +package japgolly.scalajs.react.test.emissions + +import japgolly.scalajs.react._ +import japgolly.scalajs.react.vdom.html_<^._ + +object UseStateWithReuse { + + val Component = ScalaFnComponent.withHooks[Int] + .useStateWithReuse(123) + .useStateWithReuseBy((p, s1) => p + s1.value) + .useStateWithReuseBy($ => $.props + $.hook1.value + $.hook2.value) + .render { (_, s1, s2, s3) => + val sum = s1.value + s2.value + s3.value + <.button( + "DEBUG = ", sum, + ^.onClick --> s1.modState(_ + 1), + ) + } +} diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out2.js new file mode 100644 index 000000000..a9ee064b5 --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out2.js @@ -0,0 +1,135 @@ +'use strict'; + +var _s = $RefreshSig$(); + +import * as $i_react from "react"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusability from "./japgolly.scalajs.react.Reusability.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2 from "./japgolly.scalajs.react.hooks.HookCtx$P2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF from "./japgolly.scalajs.react.hooks.Hooks$UseStateF.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF from "./japgolly.scalajs.react.hooks.Hooks$UseStateWithReuseF.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 from "./japgolly.scalajs.react.internal.Singleton$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024 from "./japgolly.scalajs.react.vdom.Attr$EventCallback$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement from "./japgolly.scalajs.react.vdom.VdomElement.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002eFunction1 from "./scala.Function1.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; +import * as $j_scala$002escalajs$002eruntime$002eWrappedVarArgs from "./scala.scalajs.runtime.WrappedVarArgs.js"; + +function $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$() { + this.Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$__f_Component = null; + $n_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$ = this; + + var rawComponent = arg1$2 => $m_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$().japgolly$scalajs$react$test$emissions$UseStateWithReuse$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2); + + var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$(), null)); + this.Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$1.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$ }; +$c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$; + +function $h_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$ }; +$h_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$.prototype; + +$c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$.prototype.japgolly$scalajs$react$test$emissions$UseStateWithReuse$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__Ljapgolly_scalajs_react_internal_Box = function (props$1, hook1$1) { + var $$x2 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); + var $$x1 = $j_java$002elang$002eObject.$uI(props$1.a); + var this$1 = hook1$1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + return $$x2.apply__O__Ljapgolly_scalajs_react_internal_Box($$x1 + $j_java$002elang$002eObject.$uI(this$1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]) | 0); +}; + +$c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$.prototype.japgolly$scalajs$react$test$emissions$UseStateWithReuse$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box = function (hook3_ctx$1) { + var $$x3 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); + var $$x2 = $j_java$002elang$002eObject.$uI(hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props); + var this$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1); + var this$2 = this$1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var $$x1 = $j_java$002elang$002eObject.$uI(this$2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]); + var this$3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2); + var this$4 = this$3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + return $$x3.apply__O__Ljapgolly_scalajs_react_internal_Box(($$x2 + $$x1 | 0) + $j_java$002elang$002eObject.$uI(this$4.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]) | 0); +}; + +$c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$.prototype.japgolly$scalajs$react$test$emissions$UseStateWithReuse$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s(function (props) { + _s(); + + var hook1_raw = $i_react.useState(() => { + $m_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$(); + return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123); + }); + var this$2 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var r = this$2.by_$eq$eq__F2(); + var ct = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var rr = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r); + var this$6 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); + var us = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$6, r); + var hook1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us, rr, ct); + var hook2_raw = $i_react.useState(((props$1, hook1$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$().japgolly$scalajs$react$test$emissions$UseStateWithReuse$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__Ljapgolly_scalajs_react_internal_Box(props$1, hook1$1))(props, hook1)); + var this$7 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var r$1 = this$7.by_$eq$eq__F2(); + var ct$1 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var rr$1 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r$1); + var this$11 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); + var us$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$11, r$1); + var hook2 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us$1, rr$1, ct$1); + var props$2 = props.a; + var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$2, hook1, hook2); + var hook3_raw = $i_react.useState((hook3_ctx$1 => () => $m_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$().japgolly$scalajs$react$test$emissions$UseStateWithReuse$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box(hook3_ctx$1))(hook3_ctx)); + var this$13 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var r$2 = this$13.by_$eq$eq__F2(); + var ct$2 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var rr$2 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r$2); + var this$17 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); + var us$2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$17, r$2); + var hook3 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us$2, rr$2, ct$2); + var this$18 = hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var $$x2 = $j_java$002elang$002eObject.$uI(this$18.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]); + var this$19 = hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var $$x1 = $j_java$002elang$002eObject.$uI(this$19.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]); + var this$20 = hook3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var sum = ($$x2 + $$x1 | 0) + $j_java$002elang$002eObject.$uI(this$20.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]) | 0; + var $$x3 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("DEBUG = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((hook1$2 => () => hook1$2.modState__F1__Ljapgolly_scalajs_react_Reusable(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$2$2 => { + var x$2 = $j_java$002elang$002eObject.$uI(x$2$2); + return 1 + x$2 | 0; + })))(hook1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().reusableDefaultSync__F1())]; + var this$32 = $$x3.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("button", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); + return $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement.$f_Ljapgolly_scalajs_react_vdom_VdomElement__rawNode__sjs_js_$bar(this$32); +}, "w7T9geXFnWi06+mB1Hyj8CKB8Kk="); +var $d_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$: 0 +}, false, "japgolly.scalajs.react.test.emissions.UseStateWithReuse$", { + Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$ }; +$c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$; +var $n_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$; + +function $m_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$) { + $n_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$ = new $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$ }; diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala index a086113f7..0d507d0bb 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala @@ -21,6 +21,7 @@ object ReactRefreshTest extends TestSuite { "sjr" - { "HooksWithChildren" - testScala() "UseState" - testScala() + "UseStateWithReuse" - testScala() } } diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala index 388504625..5d0d75523 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala @@ -35,7 +35,7 @@ object TestJs { val humanReadable: Hack = { // Lines that simply initialise object singletons - val objectInit = """^ *(?:\$j_[a-zA-Z0-9_]+\$\.)?\$m_[a-zA-Z0-9_]+\$\(\); *$""".r + val objectInit = """^ *(?:\$j_[a-zA-Z0-9_]+\$?\.)?\$m_[a-zA-Z0-9_]+\$\(\); *$""".r apply(_ .modifyLines(_ @@ -54,9 +54,12 @@ object TestJs { // Hacks to apply before comparison, so that tests consitently pass val comparisonHacks: Hack = - apply(_.modify(_ - .replace("PropsChildren$", "PropsChildren") // Not sure why SJS sometimes emits one or the other - )) + apply(_ + .filterNot(_ startsWith "import ") + .modify(_ + .replace("PropsChildren$", "PropsChildren") // Not sure why SJS sometimes emits one or the other + ) + ) val forComparison: Hack = humanReadable >> comparisonHacks From cfb090c8b6da35f32ff0fb7951d8a6b1f433692d Mon Sep 17 00:00:00 2001 From: David Barri Date: Tue, 7 Jun 2022 14:23:20 +1000 Subject: [PATCH 17/72] Create AbstractHookMacros --- .../scalajs/react/hooks/HookMacros.scala | 318 +++++------------- .../react/hooks/AbstractHookMacros.scala | 300 +++++++++++++++++ 2 files changed, 390 insertions(+), 228 deletions(-) create mode 100644 library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala index 94224f754..305a7d5a8 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -3,10 +3,9 @@ package japgolly.scalajs.react.hooks import japgolly.microlibs.compiletime.MacroUtils import japgolly.scalajs.react.component.ScalaFn.Component import japgolly.scalajs.react.hooks.Api._ -import japgolly.scalajs.react.internal.{Box, MacroLogger} +import japgolly.scalajs.react.internal.Box import japgolly.scalajs.react.vdom.VdomNode import japgolly.scalajs.react.{Children, CtorType} -import scala.annotation.{nowarn, tailrec} import scala.reflect.macros.blackbox.Context object HookMacros { @@ -35,84 +34,120 @@ class HookMacros(val c: Context) extends MacroUtils { private def PropsChildren: Tree = q"_root_.japgolly.scalajs.react.PropsChildren" private def React : Tree = q"_root_.japgolly.scalajs.react.facade.React" private def ScalaFn : Tree = q"_root_.japgolly.scalajs.react.component.ScalaFn" - private def withHooks = "withHooks" - private case class HookDefn(steps: List[HookStep]) + private final class HookMacrosImpl extends AbstractHookMacros { + import AbstractHookMacros._ - private case class HookStep(name: String, targs: List[Tree], args: List[List[Tree]]) + override type Tree = c.universe.Tree - private class HookRewriter(props: Tree, initChildren: Tree, propsChildren: Tree) { - private var stmts = Vector.empty[Tree] - private var hooks = List.empty[Ident] - private var _hookCount = 0 - private var _usesChildren = false + override type Apply = c.universe.Apply + override val Apply = new ApplyExtractor { + override def apply(fun: Tree, args: List[Tree]) = c.universe.Apply(fun, args) + override def unapply(a: Apply) = c.universe.Apply.unapply(a) + } - def usesChildren() = - _usesChildren + override type TypeApply = c.universe.TypeApply + override val TypeApply = new TypeApplyExtractor { + override def apply(fun: Tree, args: List[Tree]) = c.universe.TypeApply(fun, args) + override def unapply(a: TypeApply) = c.universe.TypeApply.unapply(a) + } - def useChildren(): Unit = { - _usesChildren = true - this += initChildren + override type Select = c.universe.Select + override val Select = new SelectExtractor { + override def apply(qualifier: Tree, name: String) = c.universe.Select(qualifier, TermName(name)) + override def unapply(a: Select) = c.universe.Select.unapply(a).map(x => (x._1, x._2.toString)) } - def +=(stmt: Tree): Unit = - stmts :+= stmt + override type Function = c.universe.Function + override val Function = new FunctionExtractor { + override def unapply(f: Function) = c.universe.Function.unapply(f) + } - def hookCount(): Int = - _hookCount + override def showRaw(t: Tree): String = c.universe.showRaw(t) + override def showCode(t: Tree): String = c.universe.showCode(t) - def nextHookName(suffix: String = ""): TermName = - TermName("hook" + (hookCount() + 1) + suffix) + override type HookRef = TermName - def registerHook(h: TermName): Unit = { - hooks :+= Ident(h) - _hookCount += 1 - } + override def rewriter() = + new HookRewriter[Tree, TermName] { + override protected def props = q"props.unbox" + override protected def initChildren = q"val children = $PropsChildren.fromRawProps(props)" + override protected def propsChildren = q"children" + override protected def Apply(t: Tree, as: List[Tree]) = c.universe.Apply(t, as) + override protected def hookCtx(withChildren: Boolean) = if (withChildren) q"$HookCtx.withChildren" else HookCtx + override protected def Ident(name: TermName) = c.universe.Ident(name) + override protected def TermName(name: String) = c.universe.TermName(name) + override protected def ValDef(n: TermName, t: Tree) = q"val $n = $t" + override def wrap(body: Tree) = q"..$stmts; $body" + + } + + override def call(function: Tree, args: List[Tree]): Tree = { + import internal._ + + function match { + case Function(params, body) => + + // From scala/test/files/run/macro-range/Common_1.scala + class TreeSubstituter(from: List[Symbol], to: List[Tree]) extends Transformer { + override def transform(tree: Tree): Tree = tree match { + case Ident(_) => + def subst(from: List[Symbol], to: List[Tree]): Tree = + if (from.isEmpty) tree + else if (tree.symbol == from.head) to.head.duplicate + else subst(from.tail, to.tail); + subst(from, to) + case _ => + val tree1 = super.transform(tree) + if (tree1 ne tree) setType(tree1, null) + tree1 + } + } + val t = new TreeSubstituter(params.map(_.symbol), args) + t.transform(body) - def args(): List[Tree] = - if (usesChildren()) - props :: propsChildren :: hooks - else - props :: hooks - - def ctxArg(): Tree = { - val hookCtxObj = if (usesChildren()) q"$HookCtx.withChildren" else HookCtx - val create = Apply(hookCtxObj, args()) - val name = nextHookName("_ctx") - this += q"val $name = $create" - Ident(name) + case _ => + Apply(Select(function, "apply"), args) + } } - def wrap(body: Tree): Tree = - q"..$stmts; $body" + override protected def vdomRawNode(vdom: Tree) = + q"$vdom.rawNode" + + override protected def useStateFn(tpe: Tree, body: Tree) = + q"$React.useStateFn(() => $Box[$tpe]($body))" + + override protected def useStateFromJsBoxed(tpe: Tree, raw: HookRef) = + q"$Hooks.UseState.fromJsBoxed[$tpe]($raw)" + + override protected def useStateWithReuseFromJsBoxed(tpe: Tree, raw: HookRef, reuse: Tree, ct: Tree) = + q"$Hooks.UseStateWithReuse.fromJsBoxed[$tpe]($raw)($reuse, $ct)" } - // ------------------------------------------------------------------------------------------------------------------- + // =================================================================================================================== def render[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] (f: c.Tree)(step: c.Tree, s: c.Tree) (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = { - implicit val log = MacroLogger() + val hookMacros = new HookMacrosImpl + import hookMacros.log + log.enabled = showCode(c.macroApplication).contains("DEBUG") // TODO: DELETE log.header() - log("macroApplication", showRaw(c.macroApplication)) - val self = c.prefix - - val parsed = parseHookDefn(c.macroApplication, Nil, Nil, Nil) + val result: Tree = + hookMacros(c.macroApplication) match { - val inlined = parsed - .flatMap(inlineHookDefn) - .map(inlineHookRawComponent[P]) - .map(inlineHookComponent[P, C](_, s)) + case Right(newBody) => + c.untypecheck(q""" + val rawComponent: $JsFn.RawComponent[${Box(P)}] = props => $newBody + $ScalaFn.fromBoxed($JsFn.fromJsFn[${Box(P)}, $C](rawComponent)($s)) + """) - val result: Tree = - inlined match { - case Right(r) => - r - case Left(e) => - log(e()) + case Left(err) => + log(err()) // TODO: make a proper warning? + val self = c.prefix q""" val f = $step.squash($f) $self.render(f)($s) @@ -122,177 +157,4 @@ class HookMacros(val c: Context) extends MacroUtils { log.footer(showCode(result)) result } - - @tailrec - private def parseHookDefn(tree: Tree, targs: List[Tree], args: List[List[Tree]], steps: List[HookStep]) - (implicit log: MacroLogger): Either[() => String, HookDefn] = - tree match { - - case Apply(t, a) => - parseHookDefn(t, targs, a :: args, steps) - - case TypeApply(t, a) => - if (targs.isEmpty) - parseHookDefn(t, a, args, steps) - else - Left(() => "Multiple type arg clauses found at " + showRaw(tree)) - - case Select(t, n) => - val name = n.toString - if (name == withHooks) { - if (args.nonEmpty) - Left(() => s"$withHooks called with args when none exepcted: ${args.map(_.map(showCode(_)))}") - else - Right(HookDefn(steps)) - } else { - val step = HookStep(name, targs, args) - log(s"Found step '$name'", step) - parseHookDefn(t, Nil, Nil, step :: steps) - } - - case _ => - Left(() => "Don't know how to parse " + showRaw(tree)) - } - - private def inlineHookDefn(h: HookDefn)(implicit log: MacroLogger): Either[() => String, HookRewriter => Tree] = { - val it = h.steps.iterator - var renderStep: HookStep = null - var hooks = Vector.empty[HookRewriter => TermName] - var withPropsChildren = false - while (it.hasNext) { - val step = it.next() - if (it.hasNext) { - if (hooks.isEmpty && step.name == "withPropsChildren") - withPropsChildren = true - else - inlineHookStep(step) match { - case Right(h) => hooks :+= h - case Left(e) => return Left(e) - } - } else - renderStep = step - } - - hookRenderInliner(renderStep).map { buildRender => b => - if (withPropsChildren) - b.useChildren() - for (h <- hooks) - b registerHook h(b) - buildRender(b) - } - } - - private def inlineHookStep(step: HookStep)(implicit log: MacroLogger): Either[() => String, HookRewriter => TermName] = { - log("inlineHookStep." + step.name, step) - - def by[A](fn: Tree)(use: (HookRewriter, Tree) => A): Either[() => String, HookRewriter => A] = - fn match { - case f@ Function(params, _) => - Right { b => - if (params.sizeIs == 1) { - val ctxArg = b.ctxArg() - use(b, call(f, ctxArg :: Nil)) - } else - use(b, call(f, b.args())) - } - - case _ => - Left(() => s"Expected a function, found: ${showRaw(fn)}") - } - - def maybeBy[A](f: Tree)(use: (HookRewriter, Tree) => A): Either[() => String, HookRewriter => A] = - if (step.name endsWith "By") - by(f)(use) - else - Right(use(_, f)) - - def useState(b: HookRewriter, tpe: Tree, body: Tree) = { - val rawName = b.nextHookName("_raw") - val name = b.nextHookName() - b += q"val $rawName = $React.useStateFn(() => $Box[$tpe]($body))" - b += q"val $name = $Hooks.UseState.fromJsBoxed[$tpe]($rawName)" - name - } - - def useStateWithReuse(b: HookRewriter, tpe: Tree, body: Tree, reuse: Tree, ct: Tree) = { - val rawName = b.nextHookName("_raw") - val name = b.nextHookName() - b += q"val $rawName = $React.useStateFn(() => $Box[$tpe]($body))" - b += q"val $name = $Hooks.UseStateWithReuse.fromJsBoxed[$tpe]($rawName)($reuse, $ct)" - name - } - - step.name match { - - case "useState" | "useStateBy" => - val List(tpe) = step.targs : @nowarn - val List(List(f), _) = step.args : @nowarn - maybeBy(f)(useState(_, tpe, _)) - - case "useStateWithReuse" | "useStateWithReuseBy" => - val List(tpe) = step.targs : @nowarn - val List(List(f), List(ct, reuse, _)) = step.args : @nowarn - maybeBy(f)(useStateWithReuse(_, tpe, _, reuse, ct)) - - case _ => - Left(() => s"Inlining of hook method '${step.name}' not yet supported.") - } - } - - private def hookRenderInliner(step: HookStep)(implicit log: MacroLogger): Either[() => String, HookRewriter => Tree] = { - log("inlineHookRender." + step.name, step) - step.name match { - case "render" => - val List(List(renderFn), _) = step.args : @nowarn - Right(b => call(renderFn, b.args())) - - case _ => - Left(() => s"Inlining of hook render method '${step.name}' not yet supported.") - } - } - - private def inlineHookRawComponent[P](rewrite: HookRewriter => Tree)(implicit P: c.WeakTypeTag[P]): Tree = { - val b = new HookRewriter(q"props.unbox", q"val children = $PropsChildren.fromRawProps(props)", q"children") - val render1 = rewrite(b) - val render2 = b.wrap(q"$render1.rawNode") - q"(props => $render2): $JsFn.RawComponent[${Box(P)}]" - } - - private def inlineHookComponent[P, C <: Children](rawComp: Tree, summoner: c.Tree)(implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): Tree = { - c.untypecheck(q""" - val rawComponent = $rawComp - $ScalaFn.fromBoxed($JsFn.fromJsFn[${Box(P)}, $C](rawComponent)($summoner)) - """) - } - - // ------------------------------------------------------------------------------------------------------------------- - - private def call(function: Tree, args: List[Tree]): Tree = { - import internal._ - - function match { - case Function(params, body) => - - // From scala/test/files/run/macro-range/Common_1.scala - class TreeSubstituter(from: List[Symbol], to: List[Tree]) extends Transformer { - override def transform(tree: Tree): Tree = tree match { - case Ident(_) => - def subst(from: List[Symbol], to: List[Tree]): Tree = - if (from.isEmpty) tree - else if (tree.symbol == from.head) to.head.duplicate - else subst(from.tail, to.tail); - subst(from, to) - case _ => - val tree1 = super.transform(tree) - if (tree1 ne tree) setType(tree1, null) - tree1 - } - } - val t = new TreeSubstituter(params.map(_.symbol), args) - t.transform(body) - - case _ => - Apply(Select(function, TermName("apply")), args) - } - } } diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala new file mode 100644 index 000000000..9c47015be --- /dev/null +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala @@ -0,0 +1,300 @@ +package japgolly.scalajs.react.hooks + +import japgolly.scalajs.react.internal.MacroLogger +import scala.annotation.{nowarn, tailrec} + +object AbstractHookMacros { + + trait HookRewriterApi[Tree, TermName] { + def +=(stmt: Tree): Unit + def valDef(name: TermName, body: Tree): Unit + def args(): List[Tree] + def ctxArg(): Tree + def hookCount(): Int + def nextHookName(suffix: String): TermName + def registerHook(h: TermName): Unit + def useChildren(): Unit + def usesChildren(): Boolean + def wrap(body: Tree): Tree + + final def nextHookName(): TermName = nextHookName("") + } + + trait HookRewriter[Tree, TermName] extends HookRewriterApi[Tree, TermName] { + protected var stmts = Vector.empty[Tree] + private var hooks = List.empty[Tree] + private var _hookCount = 0 + private var _usesChildren = false + + final override def usesChildren() = + _usesChildren + + final override def useChildren(): Unit = { + _usesChildren = true + this += initChildren + } + + final override def +=(stmt: Tree): Unit = + stmts :+= stmt + + final def valDef(name: TermName, body: Tree): Unit = + this += ValDef(name, body) + + final override def hookCount(): Int = + _hookCount + + final override def nextHookName(suffix: String = ""): TermName = + TermName("hook" + (hookCount() + 1) + suffix) + + final override def registerHook(h: TermName): Unit = { + hooks :+= Ident(h) + _hookCount += 1 + } + + final override def args(): List[Tree] = + if (usesChildren()) + props :: propsChildren :: hooks + else + props :: hooks + + final override def ctxArg(): Tree = { + val hookCtxObj = hookCtx(usesChildren()) + val create = Apply(hookCtxObj, args()) + val name = nextHookName("_ctx") + valDef(name, create) + Ident(name) + } + + protected def props: Tree + protected def initChildren: Tree + protected def propsChildren: Tree + + protected def Apply(t: Tree, args: List[Tree]): Tree + protected def hookCtx(withChildren: Boolean): Tree + protected def Ident(name: TermName): Tree + protected def TermName(name: String): TermName + protected def ValDef(name: TermName, body: Tree): Tree + } +} + +@nowarn("msg=unchecked since it is eliminated by erasure|type test cannot be checked at run time") +trait AbstractHookMacros { + import AbstractHookMacros._ + + // =================================================================================================================== + // Abstractions + + type Tree + + protected type Apply <: Tree + protected val Apply: ApplyExtractor + protected abstract class ApplyExtractor { + def apply(fun: Tree, args: List[Tree]): Apply + def unapply(apply: Apply): Option[(Tree, List[Tree])] + } + + protected type TypeApply <: Tree + protected val TypeApply: TypeApplyExtractor + protected abstract class TypeApplyExtractor { + def apply(fun: Tree, args: List[Tree]): TypeApply + def unapply(typeApply: TypeApply): Option[(Tree, List[Tree])] + } + + protected type Select <: Tree + protected val Select: SelectExtractor + protected abstract class SelectExtractor { + def apply(qualifier: Tree, name: String): Select + def unapply(select: Select): Option[(Tree, String)] + } + + protected type Function <: Tree + protected val Function: FunctionExtractor + protected abstract class FunctionExtractor { + def unapply(function: Function): Option[(List[Tree], Tree)] + } + + protected def showRaw(t: Tree): String + protected def showCode(t: Tree): String + + type HookRef + + def rewriter(): Rewriter + + protected def call(function: Tree, args: List[Tree]): Tree + + protected def useStateFn (tpe: Tree, body: Tree) : Tree + protected def useStateFromJsBoxed (tpe: Tree, raw: HookRef) : Tree + protected def useStateWithReuseFromJsBoxed(tpe: Tree, raw: HookRef, reuse: Tree, ct: Tree): Tree + protected def vdomRawNode (vdom: Tree) : Tree + + // =================================================================================================================== + // Concrete + + type Rewriter = HookRewriterApi[Tree, HookRef] + + implicit val log = MacroLogger() + + case class HookDefn(steps: List[HookStep]) + + case class HookStep(name: String, targs: List[Tree], args: List[List[Tree]]) + + private val withHooks = "withHooks" + + final def apply(tree: Tree): Either[() => String, Tree] = + for { + p <- parse(tree) + r <- rewriteComponent(p) + } yield applyRewrite(r) + + final def parse(tree: Tree): Either[() => String, HookDefn] = + _parse(tree, Nil, Nil, Nil) + + @tailrec + private def _parse(tree: Tree, targs: List[Tree], args: List[List[Tree]], steps: List[HookStep]): Either[() => String, HookDefn] = + tree match { + + case Apply(t, a) => + _parse(t, targs, a :: args, steps) + + case TypeApply(t, a) => + if (targs.isEmpty) + _parse(t, a, args, steps) + else + Left(() => "Multiple type arg clauses found at " + showRaw(tree)) + + case Select(t, name) => + if (name == withHooks) { + if (args.nonEmpty) + Left(() => s"$withHooks called with args when none exepcted: ${args.map(_.map(showCode(_)))}") + else + Right(HookDefn(steps)) + } else { + val step = HookStep(name, targs, args) + log(s"Found step '$name'", step) + _parse(t, Nil, Nil, step :: steps) + } + + case _ => + Left(() => "Don't know how to parse " + showRaw(tree)) + } + + def applyRewrite(rewrite: Rewriter => Tree): Tree = { + val b = rewriter() + val vdom = rewrite(b) + b.wrap(vdomRawNode(vdom)) + } + + def rewriteComponent(h: HookDefn): Either[() => String, Rewriter => Tree] = { + val it = h.steps.iterator + var renderStep = null : HookStep + var hooks = Vector.empty[Rewriter => HookRef] + var withPropsChildren = false + while (it.hasNext) { + val step = it.next() + if (it.hasNext) { + if (hooks.isEmpty && step.name == "withPropsChildren") + withPropsChildren = true + else + rewriteStep(step) match { + case Right(h) => hooks :+= h + case Left(e) => return Left(e) + } + } else + renderStep = step + } + + rewriteRender(renderStep).map { buildRender => b => + if (withPropsChildren) + b.useChildren() + for (h <- hooks) + b registerHook h(b) + buildRender(b) + } + } + + def rewriteStep(step: HookStep): Either[() => String, Rewriter => HookRef] = { + log("rewriteStep:" + step.name, step) + + def by[A](fn: Tree)(use: (Rewriter, Tree) => A): Either[() => String, Rewriter => A] = + fn match { + case f@ Function(params, _) => + Right { b => + val takesHookCtx = ( + b.hookCount() > 1 && // HookCtx only provided from the second hook onwards + params.sizeIs == 1 // Function argument takes a single param + ) + val args = + if (takesHookCtx) + b.ctxArg() :: Nil + else + b.args() + use(b, call(f, args)) + } + + case _ => + Left(() => s"Expected a function, found: ${showRaw(fn)}") + } + + def maybeBy[A](f: Tree)(use: (Rewriter, Tree) => A): Either[() => String, Rewriter => A] = + if (step.name endsWith "By") + by(f)(use) + else + Right(use(_, f)) + + step.name match { + + case "useState" | "useStateBy" => + val List(tpe) = step.targs : @nowarn + val List(List(f), _) = step.args : @nowarn + maybeBy(f) { (b, body) => + val rawName = b.nextHookName("_raw") + val name = b.nextHookName() + b.valDef(rawName, useStateFn(tpe, body)) + b.valDef(name, useStateFromJsBoxed(tpe, rawName)) + name + } + + case "useStateWithReuse" | "useStateWithReuseBy" => + val List(tpe) = step.targs : @nowarn + val List(List(f), List(ct, reuse, _)) = step.args : @nowarn + maybeBy(f) { (b, body) => + val rawName = b.nextHookName("_raw") + val name = b.nextHookName() + b.valDef(rawName, useStateFn(tpe, body)) + b.valDef(name, useStateWithReuseFromJsBoxed(tpe, rawName, reuse, ct)) + name + } + + case _ => + Left(() => s"Inlining of hook method '${step.name}' not yet supported.") + } + } + + def rewriteRender(step: HookStep)(implicit log: MacroLogger): Either[() => String, Rewriter => Tree] = { + log("rewriteRender:" + step.name, step) + step.name match { + + case "render" => + val List(List(renderFn), _) = step.args : @nowarn + Right(b => call(renderFn, b.args())) + + case _ => + Left(() => s"Inlining of hook render method '${step.name}' not yet supported.") + } + } + + // private def inlineHookRawComponent[P](rewrite: HookRewriter2 => Tree)(implicit P: c.WeakTypeTag[P]): Tree = { + // val b = new HookRewriter2(q"props.unbox", q"val children = $PropsChildren.fromRawProps(props)", q"children") + // val render1 = rewrite(b) + // val render2 = b.wrap(q"$render1.rawNode") + // q"(props => $render2): $JsFn.RawComponent[${Box(P)}]" + // } + + // private def inlineHookComponent[P, C <: Children](rawComp: Tree, summoner: c.Tree)(implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): Tree = { + // c.untypecheck(q""" + // val rawComponent = $rawComp + // $ScalaFn.fromBoxed($JsFn.fromJsFn[${Box(P)}, $C](rawComponent)($summoner)) + // """) + // } + +} From 2005e882156d880ecc0a552af5fa0c888154116d Mon Sep 17 00:00:00 2001 From: David Barri Date: Wed, 8 Jun 2022 12:35:05 +1000 Subject: [PATCH 18/72] Add `tcc` sbt alias --- library/aliases.sbt | 1 + library/project/Lib.scala | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/library/aliases.sbt b/library/aliases.sbt index 8f88333fe..b57984ac5 100644 --- a/library/aliases.sbt +++ b/library/aliases.sbt @@ -12,6 +12,7 @@ addCommandAlias("TEJ", "project testEmissionsJS") addCommandAlias("TT", "project tests") addCommandAlias("TU", "project testUtil") +addCommandAlias("tcc", "compile; Test/clean; Test/compile") addCommandAlias("tt", "tests/test") addCommandAlias("te", "testEmissions/test") addCommandAlias("cte", "testEmissionsJS/clean;testEmissions/test") diff --git a/library/project/Lib.scala b/library/project/Lib.scala index 112495132..3bce8d278 100644 --- a/library/project/Lib.scala +++ b/library/project/Lib.scala @@ -88,6 +88,10 @@ object Lib { libraryDependencies ++= Seq(Dep.betterMonadicFor, Dep.kindProjector).filter(_ => scalaVersion.value startsWith "2"), disable := false, dependencyOverrides ++= globalDependencyOverrides.value, + Test / clean := { + val dir = (Test / classDirectory).value + IO.delete(dir) + } ) def byScalaVersion[A](f: PartialFunction[(Long, Long), Seq[A]]): Def.Initialize[Seq[A]] = From 9967f39306072b9fe7262aab1eb289167edb1e72 Mon Sep 17 00:00:00 2001 From: David Barri Date: Wed, 8 Jun 2022 14:00:20 +1000 Subject: [PATCH 19/72] Prepare `AbstractHookMacros` for Scala 3 --- .../scalajs/react/hooks/HookMacros.scala | 74 ++++--- .../react/hooks/AbstractHookMacros.scala | 196 ++++++++++-------- 2 files changed, 153 insertions(+), 117 deletions(-) diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala index 305a7d5a8..bbe0cd234 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -38,53 +38,71 @@ class HookMacros(val c: Context) extends MacroUtils { private final class HookMacrosImpl extends AbstractHookMacros { import AbstractHookMacros._ - override type Tree = c.universe.Tree + override type Expr[A] = Term + override type HookRef = TermName + override type Stmt = c.universe.Tree + override type Term = c.universe.Tree + override type Type[A] = TypeTree + override type TypeTree = c.universe.Tree + + override protected def asTerm[A](e: Expr[A]) = e + override protected def Expr[A](t: Term) = t + override protected def hookRefToTerm(r: HookRef) = Ident(r) + override protected def Type[A](t: TypeTree) = t override type Apply = c.universe.Apply override val Apply = new ApplyExtractor { - override def apply(fun: Tree, args: List[Tree]) = c.universe.Apply(fun, args) - override def unapply(a: Apply) = c.universe.Apply.unapply(a) + override def apply(fun: Term, args: List[Term]) = c.universe.Apply(fun, args) + override def unapply(a: Term) = a match { + case c.universe.Apply(x, y) => Some((x, y)) + case _ => None + } } override type TypeApply = c.universe.TypeApply override val TypeApply = new TypeApplyExtractor { - override def apply(fun: Tree, args: List[Tree]) = c.universe.TypeApply(fun, args) - override def unapply(a: TypeApply) = c.universe.TypeApply.unapply(a) + override def apply(fun: Term, args: List[TypeTree]) = c.universe.TypeApply(fun, args) + override def unapply(a: Term) = a match { + case c.universe.TypeApply(x, y) => Some((x, y)) + case _ => None + } } override type Select = c.universe.Select override val Select = new SelectExtractor { - override def apply(qualifier: Tree, name: String) = c.universe.Select(qualifier, TermName(name)) - override def unapply(a: Select) = c.universe.Select.unapply(a).map(x => (x._1, x._2.toString)) + override def apply(qualifier: Term, name: String) = c.universe.Select(qualifier, TermName(name)) + override def unapply(a: Term) = a match { + case c.universe.Select(x, y) => Some((x, y.toString)) + case _ => None + } } override type Function = c.universe.Function override val Function = new FunctionExtractor { - override def unapply(f: Function) = c.universe.Function.unapply(f) + override def unapply(a: Term) = a match { + case c.universe.Function(x, y) => Some((x, y)) + case _ => None + } } - override def showRaw(t: Tree): String = c.universe.showRaw(t) - override def showCode(t: Tree): String = c.universe.showCode(t) - - override type HookRef = TermName + override def showRaw(t: Term): String = c.universe.showRaw(t) + override def showCode(t: Term): String = c.universe.showCode(t) override def rewriter() = - new HookRewriter[Tree, TermName] { - override protected def props = q"props.unbox" + new HookRewriter[Tree, Term, HookRef] { + override protected def Apply(t: Term, as: List[Term]) = c.universe.Apply(t, as) + override protected def hookCtx(withChildren: Boolean) = if (withChildren) q"$HookCtx.withChildren" else HookCtx + override protected def Ident(name: HookRef) = c.universe.Ident(name) override protected def initChildren = q"val children = $PropsChildren.fromRawProps(props)" + override protected def props = q"props.unbox" override protected def propsChildren = q"children" - override protected def Apply(t: Tree, as: List[Tree]) = c.universe.Apply(t, as) - override protected def hookCtx(withChildren: Boolean) = if (withChildren) q"$HookCtx.withChildren" else HookCtx - override protected def Ident(name: TermName) = c.universe.Ident(name) - override protected def TermName(name: String) = c.universe.TermName(name) - override protected def ValDef(n: TermName, t: Tree) = q"val $n = $t" - override def wrap(body: Tree) = q"..$stmts; $body" - + override protected def HookRef(name: String) = c.universe.TermName(name) + override protected def ValDef(n: HookRef, t: Term) = q"val $n = $t" + override def wrap(body: Term) = q"..$stmts; $body" } override def call(function: Tree, args: List[Tree]): Tree = { import internal._ - function match { case Function(params, body) => @@ -111,17 +129,17 @@ class HookMacros(val c: Context) extends MacroUtils { } } - override protected def vdomRawNode(vdom: Tree) = - q"$vdom.rawNode" - - override protected def useStateFn(tpe: Tree, body: Tree) = + override protected def useStateFn[S] = (tpe, body) => q"$React.useStateFn(() => $Box[$tpe]($body))" - override protected def useStateFromJsBoxed(tpe: Tree, raw: HookRef) = + override protected def useStateFromJsBoxed[S] = (tpe, raw) => q"$Hooks.UseState.fromJsBoxed[$tpe]($raw)" - override protected def useStateWithReuseFromJsBoxed(tpe: Tree, raw: HookRef, reuse: Tree, ct: Tree) = + override protected def useStateWithReuseFromJsBoxed[S] = (tpe, raw, reuse, ct) => q"$Hooks.UseStateWithReuse.fromJsBoxed[$tpe]($raw)($reuse, $ct)" + + override protected def vdomRawNode = vdom => + q"$vdom.rawNode" } // =================================================================================================================== diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala index 9c47015be..26740c51d 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala @@ -1,31 +1,56 @@ package japgolly.scalajs.react.hooks -import japgolly.scalajs.react.internal.MacroLogger +import japgolly.scalajs.react.Reusability +import japgolly.scalajs.react.facade.React +import japgolly.scalajs.react.internal.{Box, MacroLogger} +import japgolly.scalajs.react.vdom.VdomNode import scala.annotation.{nowarn, tailrec} +import scala.reflect.ClassTag object AbstractHookMacros { - trait HookRewriterApi[Tree, TermName] { - def +=(stmt: Tree): Unit - def valDef(name: TermName, body: Tree): Unit - def args(): List[Tree] - def ctxArg(): Tree + // =================================================================================================================== + // Hook Rewriter + + trait HookRewriterApi[Stmt, Term, HookRef] { + def +=(stmt: Stmt): Unit + def valDef(name: HookRef, body: Term): Unit + def args(): List[Term] + def ctxArg(): Term def hookCount(): Int - def nextHookName(suffix: String): TermName - def registerHook(h: TermName): Unit + def nextHookName(suffix: String): HookRef + def registerHook(h: HookRef): Unit def useChildren(): Unit def usesChildren(): Boolean - def wrap(body: Tree): Tree + def wrap(body: Term): Term + + final def createRawAndHook(raw: Term, hook: HookRef => Term): HookRef = { + val rawName = nextHookName("_raw") + val name = nextHookName() + valDef(rawName, raw) + valDef(name, hook(rawName)) + name + } - final def nextHookName(): TermName = nextHookName("") + final def nextHookName(): HookRef = + nextHookName("") } - trait HookRewriter[Tree, TermName] extends HookRewriterApi[Tree, TermName] { - protected var stmts = Vector.empty[Tree] - private var hooks = List.empty[Tree] - private var _hookCount = 0 + trait HookRewriter[Stmt, Term, HookRef] extends HookRewriterApi[Stmt, Term, HookRef] { + protected var stmts = Vector.empty[Stmt] + private var hooks = List.empty[Term] + private var _hookCount = 0 private var _usesChildren = false + protected def Apply(t: Term, args: List[Term]): Term + protected def hookCtx(withChildren: Boolean): Term + protected def Ident(name: HookRef): Term + protected def initChildren: Stmt + protected def props: Term + protected def propsChildren: Term + protected def HookRef(name: String): HookRef + protected def ValDef(name: HookRef, body: Term): Stmt + final override def usesChildren() = _usesChildren @@ -34,123 +59,130 @@ object AbstractHookMacros { this += initChildren } - final override def +=(stmt: Tree): Unit = + final override def +=(stmt: Stmt): Unit = stmts :+= stmt - final def valDef(name: TermName, body: Tree): Unit = + final def valDef(name: HookRef, body: Term): Unit = this += ValDef(name, body) final override def hookCount(): Int = _hookCount - final override def nextHookName(suffix: String = ""): TermName = - TermName("hook" + (hookCount() + 1) + suffix) + final override def nextHookName(suffix: String = ""): HookRef = + HookRef("hook" + (hookCount() + 1) + suffix) - final override def registerHook(h: TermName): Unit = { + final override def registerHook(h: HookRef): Unit = { hooks :+= Ident(h) _hookCount += 1 } - final override def args(): List[Tree] = + final override def args(): List[Term] = if (usesChildren()) props :: propsChildren :: hooks else props :: hooks - final override def ctxArg(): Tree = { + final override def ctxArg(): Term = { val hookCtxObj = hookCtx(usesChildren()) val create = Apply(hookCtxObj, args()) val name = nextHookName("_ctx") valDef(name, create) Ident(name) } - - protected def props: Tree - protected def initChildren: Tree - protected def propsChildren: Tree - - protected def Apply(t: Tree, args: List[Tree]): Tree - protected def hookCtx(withChildren: Boolean): Tree - protected def Ident(name: TermName): Tree - protected def TermName(name: String): TermName - protected def ValDef(name: TermName, body: Tree): Tree } } -@nowarn("msg=unchecked since it is eliminated by erasure|type test cannot be checked at run time") +// @nowarn("msg=unchecked since it is eliminated by erasure|cannot be checked at run ?time") trait AbstractHookMacros { import AbstractHookMacros._ // =================================================================================================================== // Abstractions - type Tree + type Expr[A] + type HookRef + type Stmt + type Term + type Type[A] + type TypeTree + + protected def asTerm[A](e: Expr[A]): Term + protected def Expr[A](t: Term): Expr[A] + protected def hookRefToTerm(r: HookRef): Term + protected def Type[A](t: TypeTree): Type[A] - protected type Apply <: Tree + protected type Apply <: Term protected val Apply: ApplyExtractor protected abstract class ApplyExtractor { - def apply(fun: Tree, args: List[Tree]): Apply - def unapply(apply: Apply): Option[(Tree, List[Tree])] + def apply(fun: Term, args: List[Term]): Apply + def unapply(apply: Term): Option[(Term, List[Term])] } - protected type TypeApply <: Tree + protected type TypeApply <: Term protected val TypeApply: TypeApplyExtractor protected abstract class TypeApplyExtractor { - def apply(fun: Tree, args: List[Tree]): TypeApply - def unapply(typeApply: TypeApply): Option[(Tree, List[Tree])] + def apply(fun: Term, args: List[TypeTree]): TypeApply + def unapply(typeApply: Term): Option[(Term, List[TypeTree])] } - protected type Select <: Tree + protected type Select <: Term protected val Select: SelectExtractor protected abstract class SelectExtractor { - def apply(qualifier: Tree, name: String): Select - def unapply(select: Select): Option[(Tree, String)] + def apply(qualifier: Term, name: String): Select + def unapply(select: Term): Option[(Term, String)] } - protected type Function <: Tree + protected type Function <: Term protected val Function: FunctionExtractor protected abstract class FunctionExtractor { - def unapply(function: Function): Option[(List[Tree], Tree)] + def unapply(function: Term): Option[(List[Term], Term)] } - protected def showRaw(t: Tree): String - protected def showCode(t: Tree): String - - type HookRef + protected def showRaw(t: Term): String + protected def showCode(t: Term): String def rewriter(): Rewriter - protected def call(function: Tree, args: List[Tree]): Tree + protected def call(function: Term, args: List[Term]): Term - protected def useStateFn (tpe: Tree, body: Tree) : Tree - protected def useStateFromJsBoxed (tpe: Tree, raw: HookRef) : Tree - protected def useStateWithReuseFromJsBoxed(tpe: Tree, raw: HookRef, reuse: Tree, ct: Tree): Tree - protected def vdomRawNode (vdom: Tree) : Tree + protected def useStateFn[S]: (Type[S], Expr[S]) => Expr[React.UseState[Box[S]]] + protected def useStateFromJsBoxed[S]: (Type[S], Expr[React.UseState[Box[S]]]) => Expr[Hooks.UseState[S]] + protected def useStateWithReuseFromJsBoxed[S]: (Type[S], Expr[React.UseState[Box[S]]], Expr[Reusability[S]], Expr[ClassTag[S]]) => Expr[Hooks.UseStateWithReuse[S]] + protected def vdomRawNode: Expr[VdomNode] => Expr[React.Node] // =================================================================================================================== // Concrete - type Rewriter = HookRewriterApi[Tree, HookRef] + protected object AutoTypeImplicits { + @inline implicit def autoTerm[A](e: Expr[A]): Term = asTerm(e) + @inline implicit def autoHookRefToTerm(r: HookRef): Term = hookRefToTerm(r) + @inline implicit def autoHookRefToExpr[A](r: HookRef): Expr[A] = asTerm(hookRefToTerm(r)) + @inline implicit def autoTypeOf[A](t: TypeTree): Type[A] = Type(t) + @inline implicit def autoExprOf[A](t: Term): Expr[A] = Expr(t) + } - implicit val log = MacroLogger() + type Rewriter = HookRewriterApi[Stmt, Term, HookRef] + + implicit val log: MacroLogger = + MacroLogger() case class HookDefn(steps: List[HookStep]) - case class HookStep(name: String, targs: List[Tree], args: List[List[Tree]]) + case class HookStep(name: String, targs: List[TypeTree], args: List[List[Term]]) private val withHooks = "withHooks" - final def apply(tree: Tree): Either[() => String, Tree] = + final def apply(tree: Term): Either[() => String, Term] = for { p <- parse(tree) r <- rewriteComponent(p) } yield applyRewrite(r) - final def parse(tree: Tree): Either[() => String, HookDefn] = + final def parse(tree: Term): Either[() => String, HookDefn] = _parse(tree, Nil, Nil, Nil) @tailrec - private def _parse(tree: Tree, targs: List[Tree], args: List[List[Tree]], steps: List[HookStep]): Either[() => String, HookDefn] = + private def _parse(tree: Term, targs: List[TypeTree], args: List[List[Term]], steps: List[HookStep]): Either[() => String, HookDefn] = tree match { case Apply(t, a) => @@ -178,13 +210,14 @@ trait AbstractHookMacros { Left(() => "Don't know how to parse " + showRaw(tree)) } - def applyRewrite(rewrite: Rewriter => Tree): Tree = { + def applyRewrite(rewrite: Rewriter => Term): Term = { + import AutoTypeImplicits._ val b = rewriter() val vdom = rewrite(b) b.wrap(vdomRawNode(vdom)) } - def rewriteComponent(h: HookDefn): Either[() => String, Rewriter => Tree] = { + def rewriteComponent(h: HookDefn): Either[() => String, Rewriter => Term] = { val it = h.steps.iterator var renderStep = null : HookStep var hooks = Vector.empty[Rewriter => HookRef] @@ -215,7 +248,7 @@ trait AbstractHookMacros { def rewriteStep(step: HookStep): Either[() => String, Rewriter => HookRef] = { log("rewriteStep:" + step.name, step) - def by[A](fn: Tree)(use: (Rewriter, Tree) => A): Either[() => String, Rewriter => A] = + def by[A](fn: Term)(use: (Rewriter, Term) => A): Either[() => String, Rewriter => A] = fn match { case f@ Function(params, _) => Right { b => @@ -235,34 +268,33 @@ trait AbstractHookMacros { Left(() => s"Expected a function, found: ${showRaw(fn)}") } - def maybeBy[A](f: Tree)(use: (Rewriter, Tree) => A): Either[() => String, Rewriter => A] = + def maybeBy[A](f: Term)(use: (Rewriter, Term) => A): Either[() => String, Rewriter => A] = if (step.name endsWith "By") by(f)(use) else Right(use(_, f)) + import AutoTypeImplicits._ + trait X + step.name match { case "useState" | "useStateBy" => val List(tpe) = step.targs : @nowarn val List(List(f), _) = step.args : @nowarn maybeBy(f) { (b, body) => - val rawName = b.nextHookName("_raw") - val name = b.nextHookName() - b.valDef(rawName, useStateFn(tpe, body)) - b.valDef(name, useStateFromJsBoxed(tpe, rawName)) - name + b.createRawAndHook( + raw = useStateFn[X](tpe, body), + hook = useStateFromJsBoxed[X](tpe, _)) } case "useStateWithReuse" | "useStateWithReuseBy" => val List(tpe) = step.targs : @nowarn val List(List(f), List(ct, reuse, _)) = step.args : @nowarn maybeBy(f) { (b, body) => - val rawName = b.nextHookName("_raw") - val name = b.nextHookName() - b.valDef(rawName, useStateFn(tpe, body)) - b.valDef(name, useStateWithReuseFromJsBoxed(tpe, rawName, reuse, ct)) - name + b.createRawAndHook( + raw = useStateFn[X](tpe, body), + hook = useStateWithReuseFromJsBoxed[X](tpe, _, reuse, ct)) } case _ => @@ -270,7 +302,7 @@ trait AbstractHookMacros { } } - def rewriteRender(step: HookStep)(implicit log: MacroLogger): Either[() => String, Rewriter => Tree] = { + def rewriteRender(step: HookStep)(implicit log: MacroLogger): Either[() => String, Rewriter => Term] = { log("rewriteRender:" + step.name, step) step.name match { @@ -279,22 +311,8 @@ trait AbstractHookMacros { Right(b => call(renderFn, b.args())) case _ => - Left(() => s"Inlining of hook render method '${step.name}' not yet supported.") + Left(() => s"Inlining of render method '${step.name}' not yet supported.") } } - // private def inlineHookRawComponent[P](rewrite: HookRewriter2 => Tree)(implicit P: c.WeakTypeTag[P]): Tree = { - // val b = new HookRewriter2(q"props.unbox", q"val children = $PropsChildren.fromRawProps(props)", q"children") - // val render1 = rewrite(b) - // val render2 = b.wrap(q"$render1.rawNode") - // q"(props => $render2): $JsFn.RawComponent[${Box(P)}]" - // } - - // private def inlineHookComponent[P, C <: Children](rawComp: Tree, summoner: c.Tree)(implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): Tree = { - // c.untypecheck(q""" - // val rawComponent = $rawComp - // $ScalaFn.fromBoxed($JsFn.fromJsFn[${Box(P)}, $C](rawComponent)($summoner)) - // """) - // } - } From 1dda343c171231e5b93811b75f1b0d2c61c13184 Mon Sep 17 00:00:00 2001 From: David Barri Date: Wed, 8 Jun 2022 16:01:56 +1000 Subject: [PATCH 20/72] Let's try an external `HookRewriterCtx` --- .../scalajs/react/hooks/HookMacros.scala | 14 ++++++---- .../react/hooks/AbstractHookMacros.scala | 28 +++++++++++-------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala index bbe0cd234..b2d709ba8 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -88,14 +88,12 @@ class HookMacros(val c: Context) extends MacroUtils { override def showRaw(t: Term): String = c.universe.showRaw(t) override def showCode(t: Term): String = c.universe.showCode(t) - override def rewriter() = + override def rewriter(rc: RewriterCtx) = new HookRewriter[Tree, Term, HookRef] { + override protected val ctx = rc override protected def Apply(t: Term, as: List[Term]) = c.universe.Apply(t, as) override protected def hookCtx(withChildren: Boolean) = if (withChildren) q"$HookCtx.withChildren" else HookCtx override protected def Ident(name: HookRef) = c.universe.Ident(name) - override protected def initChildren = q"val children = $PropsChildren.fromRawProps(props)" - override protected def props = q"props.unbox" - override protected def propsChildren = q"children" override protected def HookRef(name: String) = c.universe.TermName(name) override protected def ValDef(n: HookRef, t: Term) = q"val $n = $t" override def wrap(body: Term) = q"..$stmts; $body" @@ -157,7 +155,13 @@ class HookMacros(val c: Context) extends MacroUtils { val result: Tree = hookMacros(c.macroApplication) match { - case Right(newBody) => + case Right(rewrite) => + val ctx = hookMacros.rewriterCtx( + props = q"props.unbox", + initChildren = q"val children = $PropsChildren.fromRawProps(props)", + children = q"children", + ) + val newBody = rewrite(ctx) c.untypecheck(q""" val rawComponent: $JsFn.RawComponent[${Box(P)}] = props => $newBody $ScalaFn.fromBoxed($JsFn.fromJsFn[${Box(P)}, $C](rawComponent)($s)) diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala index 26740c51d..7b5de58d0 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala @@ -42,13 +42,11 @@ object AbstractHookMacros { private var _hookCount = 0 private var _usesChildren = false + protected val ctx: HookRewriterCtx[Stmt, Term] protected def Apply(t: Term, args: List[Term]): Term protected def hookCtx(withChildren: Boolean): Term - protected def Ident(name: HookRef): Term - protected def initChildren: Stmt - protected def props: Term - protected def propsChildren: Term protected def HookRef(name: String): HookRef + protected def Ident(name: HookRef): Term protected def ValDef(name: HookRef, body: Term): Stmt final override def usesChildren() = @@ -56,7 +54,7 @@ object AbstractHookMacros { final override def useChildren(): Unit = { _usesChildren = true - this += initChildren + this += ctx.initChildren } final override def +=(stmt: Stmt): Unit = @@ -78,9 +76,9 @@ object AbstractHookMacros { final override def args(): List[Term] = if (usesChildren()) - props :: propsChildren :: hooks + ctx.props :: ctx.children :: hooks else - props :: hooks + ctx.props :: hooks final override def ctxArg(): Term = { val hookCtxObj = hookCtx(usesChildren()) @@ -90,6 +88,8 @@ object AbstractHookMacros { Ident(name) } } + + final case class HookRewriterCtx[Stmt, Term](props: Term, initChildren: Stmt, children: Term) } // @nowarn("msg=unchecked since it is eliminated by erasure|cannot be checked at run ?time") @@ -141,7 +141,7 @@ trait AbstractHookMacros { protected def showRaw(t: Term): String protected def showCode(t: Term): String - def rewriter(): Rewriter + def rewriter(ctx: HookRewriterCtx[Stmt, Term]): Rewriter protected def call(function: Term, args: List[Term]): Term @@ -162,6 +162,10 @@ trait AbstractHookMacros { } type Rewriter = HookRewriterApi[Stmt, Term, HookRef] + type RewriterCtx = HookRewriterCtx[Stmt, Term] + + def rewriterCtx(props: Term, initChildren: Stmt, children: Term): RewriterCtx = + HookRewriterCtx(props, initChildren, children) implicit val log: MacroLogger = MacroLogger() @@ -172,11 +176,11 @@ trait AbstractHookMacros { private val withHooks = "withHooks" - final def apply(tree: Term): Either[() => String, Term] = + final def apply(tree: Term): Either[() => String, RewriterCtx => Term] = for { p <- parse(tree) r <- rewriteComponent(p) - } yield applyRewrite(r) + } yield applyRewrite(_, r) final def parse(tree: Term): Either[() => String, HookDefn] = _parse(tree, Nil, Nil, Nil) @@ -210,9 +214,9 @@ trait AbstractHookMacros { Left(() => "Don't know how to parse " + showRaw(tree)) } - def applyRewrite(rewrite: Rewriter => Term): Term = { + def applyRewrite(ctx: RewriterCtx, rewrite: Rewriter => Term): Term = { import AutoTypeImplicits._ - val b = rewriter() + val b = rewriter(ctx) val vdom = rewrite(b) b.wrap(vdomRawNode(vdom)) } From b9ccc8bb3db99f3b0c3792922b0c470ecfa20a0a Mon Sep 17 00:00:00 2001 From: David Barri Date: Thu, 9 Jun 2022 13:32:18 +1000 Subject: [PATCH 21/72] Refactor `HookRewriter` so that `ValDef` creation is atomic --- .../scalajs/react/hooks/HookMacros.scala | 5 +- .../react/hooks/AbstractHookMacros.scala | 58 +++++++++---------- 2 files changed, 28 insertions(+), 35 deletions(-) diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala index b2d709ba8..e8148cd67 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -93,9 +93,8 @@ class HookMacros(val c: Context) extends MacroUtils { override protected val ctx = rc override protected def Apply(t: Term, as: List[Term]) = c.universe.Apply(t, as) override protected def hookCtx(withChildren: Boolean) = if (withChildren) q"$HookCtx.withChildren" else HookCtx - override protected def Ident(name: HookRef) = c.universe.Ident(name) - override protected def HookRef(name: String) = c.universe.TermName(name) - override protected def ValDef(n: HookRef, t: Term) = q"val $n = $t" + override protected def hookRefToTerm(r: HookRef) = Ident(r) + override def valDef(n: String, t: Term) = { val r = TermName(n); this += q"val $r = $t"; r } override def wrap(body: Term) = q"..$stmts; $body" } diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala index 7b5de58d0..3cef90808 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala @@ -14,28 +14,32 @@ object AbstractHookMacros { trait HookRewriterApi[Stmt, Term, HookRef] { def +=(stmt: Stmt): Unit - def valDef(name: HookRef, body: Term): Unit def args(): List[Term] def ctxArg(): Term def hookCount(): Int - def nextHookName(suffix: String): HookRef + def nextHookName(): String def registerHook(h: HookRef): Unit def useChildren(): Unit def usesChildren(): Boolean + def valDef(name: String, body: Term): HookRef def wrap(body: Term): Term final def createRawAndHook(raw: Term, hook: HookRef => Term): HookRef = { - val rawName = nextHookName("_raw") - val name = nextHookName() - valDef(rawName, raw) - valDef(name, hook(rawName)) - name + val rawDef = valDef(raw, "_raw") + hookDef(hook(rawDef)) } - final def nextHookName(): HookRef = - nextHookName("") + final def hookDef(body: Term): HookRef = + valDef(nextHookName(), body) + + final def valDef(body: Term, suffix: String): HookRef = + valDef(nextHookName() + suffix, body) } + // ------------------------------------------------------------------------------------------------------------------- + + final case class HookRewriterCtx[Stmt, Term](props: Term, initChildren: Stmt, children: Term) + trait HookRewriter[Stmt, Term, HookRef] extends HookRewriterApi[Stmt, Term, HookRef] { protected var stmts = Vector.empty[Stmt] private var hooks = List.empty[Term] @@ -45,9 +49,7 @@ object AbstractHookMacros { protected val ctx: HookRewriterCtx[Stmt, Term] protected def Apply(t: Term, args: List[Term]): Term protected def hookCtx(withChildren: Boolean): Term - protected def HookRef(name: String): HookRef - protected def Ident(name: HookRef): Term - protected def ValDef(name: HookRef, body: Term): Stmt + protected def hookRefToTerm(ref: HookRef): Term final override def usesChildren() = _usesChildren @@ -60,17 +62,14 @@ object AbstractHookMacros { final override def +=(stmt: Stmt): Unit = stmts :+= stmt - final def valDef(name: HookRef, body: Term): Unit = - this += ValDef(name, body) - final override def hookCount(): Int = _hookCount - final override def nextHookName(suffix: String = ""): HookRef = - HookRef("hook" + (hookCount() + 1) + suffix) + final override def nextHookName(): String = + "hook" + (hookCount() + 1) final override def registerHook(h: HookRef): Unit = { - hooks :+= Ident(h) + hooks :+= hookRefToTerm(h) _hookCount += 1 } @@ -83,20 +82,17 @@ object AbstractHookMacros { final override def ctxArg(): Term = { val hookCtxObj = hookCtx(usesChildren()) val create = Apply(hookCtxObj, args()) - val name = nextHookName("_ctx") - valDef(name, create) - Ident(name) + val ctx = valDef(create, "_ctx") + hookRefToTerm(ctx) } } - - final case class HookRewriterCtx[Stmt, Term](props: Term, initChildren: Stmt, children: Term) } -// @nowarn("msg=unchecked since it is eliminated by erasure|cannot be checked at run ?time") +// ===================================================================================================================== + trait AbstractHookMacros { import AbstractHookMacros._ - // =================================================================================================================== // Abstractions type Expr[A] @@ -132,10 +128,9 @@ trait AbstractHookMacros { def unapply(select: Term): Option[(Term, String)] } - protected type Function <: Term protected val Function: FunctionExtractor protected abstract class FunctionExtractor { - def unapply(function: Term): Option[(List[Term], Term)] + def unapply(function: Term): Option[Int] } protected def showRaw(t: Term): String @@ -150,7 +145,6 @@ trait AbstractHookMacros { protected def useStateWithReuseFromJsBoxed[S]: (Type[S], Expr[React.UseState[Box[S]]], Expr[Reusability[S]], Expr[ClassTag[S]]) => Expr[Hooks.UseStateWithReuse[S]] protected def vdomRawNode: Expr[VdomNode] => Expr[React.Node] - // =================================================================================================================== // Concrete protected object AutoTypeImplicits { @@ -254,18 +248,18 @@ trait AbstractHookMacros { def by[A](fn: Term)(use: (Rewriter, Term) => A): Either[() => String, Rewriter => A] = fn match { - case f@ Function(params, _) => + case Function(paramCount) => Right { b => val takesHookCtx = ( - b.hookCount() > 1 && // HookCtx only provided from the second hook onwards - params.sizeIs == 1 // Function argument takes a single param + b.hookCount() > 1 // HookCtx only provided from the second hook onwards + && paramCount == 1 // Function argument takes a single param ) val args = if (takesHookCtx) b.ctxArg() :: Nil else b.args() - use(b, call(f, args)) + use(b, call(fn, args)) } case _ => From d7633775dabcecfd1c7b63e1188388a207997527 Mon Sep 17 00:00:00 2001 From: David Barri Date: Thu, 9 Jun 2022 13:34:08 +1000 Subject: [PATCH 22/72] Rename `tec` alias --- library/aliases.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/aliases.sbt b/library/aliases.sbt index b57984ac5..691f1d094 100644 --- a/library/aliases.sbt +++ b/library/aliases.sbt @@ -15,4 +15,4 @@ addCommandAlias("TU", "project testUtil") addCommandAlias("tcc", "compile; Test/clean; Test/compile") addCommandAlias("tt", "tests/test") addCommandAlias("te", "testEmissions/test") -addCommandAlias("cte", "testEmissionsJS/clean;testEmissions/test") +addCommandAlias("tec", "testEmissionsJS/clean;testEmissions/test") From c69eaf162c3da949725773cfc12e1656aaf0b8c4 Mon Sep 17 00:00:00 2001 From: David Barri Date: Thu, 9 Jun 2022 13:43:59 +1000 Subject: [PATCH 23/72] Further prep for Scala 3 support --- .../scalajs/react/hooks/HookMacros.scala | 33 +++++++++---------- .../react/hooks/AbstractHookMacros.scala | 30 +++++------------ 2 files changed, 25 insertions(+), 38 deletions(-) diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala index e8148cd67..34af9f2e5 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -50,37 +50,30 @@ class HookMacros(val c: Context) extends MacroUtils { override protected def hookRefToTerm(r: HookRef) = Ident(r) override protected def Type[A](t: TypeTree) = t - override type Apply = c.universe.Apply - override val Apply = new ApplyExtractor { - override def apply(fun: Term, args: List[Term]) = c.universe.Apply(fun, args) + override val ApplyLike = new ApplyExtractor { override def unapply(a: Term) = a match { - case c.universe.Apply(x, y) => Some((x, y)) + case Apply(x, y) => Some((x, y)) case _ => None } } - override type TypeApply = c.universe.TypeApply - override val TypeApply = new TypeApplyExtractor { - override def apply(fun: Term, args: List[TypeTree]) = c.universe.TypeApply(fun, args) + override val TypeApplyLike = new TypeApplyExtractor { override def unapply(a: Term) = a match { - case c.universe.TypeApply(x, y) => Some((x, y)) + case TypeApply(x, y) => Some((x, y)) case _ => None } } - override type Select = c.universe.Select - override val Select = new SelectExtractor { - override def apply(qualifier: Term, name: String) = c.universe.Select(qualifier, TermName(name)) + override val SelectLike = new SelectExtractor { override def unapply(a: Term) = a match { - case c.universe.Select(x, y) => Some((x, y.toString)) + case Select(x, y) => Some((x, y.toString)) case _ => None } } - override type Function = c.universe.Function - override val Function = new FunctionExtractor { + override val FunctionLike = new FunctionExtractor { override def unapply(a: Term) = a match { - case c.universe.Function(x, y) => Some((x, y)) + case Function(params, _) => Some(params.size) case _ => None } } @@ -122,7 +115,7 @@ class HookMacros(val c: Context) extends MacroUtils { t.transform(body) case _ => - Apply(Select(function, "apply"), args) + Apply(Select(function, TermName("apply")), args) } } @@ -151,8 +144,14 @@ class HookMacros(val c: Context) extends MacroUtils { log.enabled = showCode(c.macroApplication).contains("DEBUG") // TODO: DELETE log.header() + val rewriteAttempt = + for { + p <- hookMacros.parse(c.macroApplication) + r <- hookMacros.rewriteComponent(p) + } yield hookMacros.applyRewrite(r) + val result: Tree = - hookMacros(c.macroApplication) match { + rewriteAttempt match { case Right(rewrite) => val ctx = hookMacros.rewriterCtx( diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala index 3cef90808..d541068e1 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala @@ -107,28 +107,22 @@ trait AbstractHookMacros { protected def hookRefToTerm(r: HookRef): Term protected def Type[A](t: TypeTree): Type[A] - protected type Apply <: Term - protected val Apply: ApplyExtractor + protected val ApplyLike: ApplyExtractor protected abstract class ApplyExtractor { - def apply(fun: Term, args: List[Term]): Apply def unapply(apply: Term): Option[(Term, List[Term])] } - protected type TypeApply <: Term - protected val TypeApply: TypeApplyExtractor + protected val TypeApplyLike: TypeApplyExtractor protected abstract class TypeApplyExtractor { - def apply(fun: Term, args: List[TypeTree]): TypeApply def unapply(typeApply: Term): Option[(Term, List[TypeTree])] } - protected type Select <: Term - protected val Select: SelectExtractor + protected val SelectLike: SelectExtractor protected abstract class SelectExtractor { - def apply(qualifier: Term, name: String): Select def unapply(select: Term): Option[(Term, String)] } - protected val Function: FunctionExtractor + protected val FunctionLike: FunctionExtractor protected abstract class FunctionExtractor { def unapply(function: Term): Option[Int] } @@ -170,12 +164,6 @@ trait AbstractHookMacros { private val withHooks = "withHooks" - final def apply(tree: Term): Either[() => String, RewriterCtx => Term] = - for { - p <- parse(tree) - r <- rewriteComponent(p) - } yield applyRewrite(_, r) - final def parse(tree: Term): Either[() => String, HookDefn] = _parse(tree, Nil, Nil, Nil) @@ -183,16 +171,16 @@ trait AbstractHookMacros { private def _parse(tree: Term, targs: List[TypeTree], args: List[List[Term]], steps: List[HookStep]): Either[() => String, HookDefn] = tree match { - case Apply(t, a) => + case ApplyLike(t, a) => _parse(t, targs, a :: args, steps) - case TypeApply(t, a) => + case TypeApplyLike(t, a) => if (targs.isEmpty) _parse(t, a, args, steps) else Left(() => "Multiple type arg clauses found at " + showRaw(tree)) - case Select(t, name) => + case SelectLike(t, name) => if (name == withHooks) { if (args.nonEmpty) Left(() => s"$withHooks called with args when none exepcted: ${args.map(_.map(showCode(_)))}") @@ -208,7 +196,7 @@ trait AbstractHookMacros { Left(() => "Don't know how to parse " + showRaw(tree)) } - def applyRewrite(ctx: RewriterCtx, rewrite: Rewriter => Term): Term = { + def applyRewrite(rewrite: Rewriter => Term): RewriterCtx => Expr[React.Node] = ctx => { import AutoTypeImplicits._ val b = rewriter(ctx) val vdom = rewrite(b) @@ -248,7 +236,7 @@ trait AbstractHookMacros { def by[A](fn: Term)(use: (Rewriter, Term) => A): Either[() => String, Rewriter => A] = fn match { - case Function(paramCount) => + case FunctionLike(paramCount) => Right { b => val takesHookCtx = ( b.hookCount() > 1 // HookCtx only provided from the second hook onwards From e3c8da89ef66743217fa2dd5b117a613e8986f82 Mon Sep 17 00:00:00 2001 From: David Barri Date: Thu, 9 Jun 2022 16:11:19 +1000 Subject: [PATCH 24/72] Scala 3 rewriting acting like its working --- .../scalajs/react/hooks/HookMacros.scala | 8 +- .../scalajs/react/hooks/HookMacros.scala | 172 +++++++++++++++-- .../react/hooks/AbstractHookMacros.scala | 10 +- .../rr-sjr/HooksWithChildren-out3.js | 102 ++++++++++ .../test/resources/rr-sjr/UseState-out3.js | 140 ++++++++++++++ .../rr-sjr/UseStateWithReuse-out3.js | 177 ++++++++++++++++++ 6 files changed, 585 insertions(+), 24 deletions(-) create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out3.js create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out3.js create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out3.js diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala index 34af9f2e5..c1cd819d4 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -85,10 +85,14 @@ class HookMacros(val c: Context) extends MacroUtils { new HookRewriter[Tree, Term, HookRef] { override protected val ctx = rc override protected def Apply(t: Term, as: List[Term]) = c.universe.Apply(t, as) - override protected def hookCtx(withChildren: Boolean) = if (withChildren) q"$HookCtx.withChildren" else HookCtx override protected def hookRefToTerm(r: HookRef) = Ident(r) override def valDef(n: String, t: Term) = { val r = TermName(n); this += q"val $r = $t"; r } override def wrap(body: Term) = q"..$stmts; $body" + + override protected def hookCtx(withChildren: Boolean, args: List[Term]) = { + val obj = if (withChildren) q"$HookCtx.withChildren" else HookCtx + Apply(obj, args) + } } override def call(function: Tree, args: List[Tree]): Tree = { @@ -141,7 +145,7 @@ class HookMacros(val c: Context) extends MacroUtils { val hookMacros = new HookMacrosImpl import hookMacros.log - log.enabled = showCode(c.macroApplication).contains("DEBUG") // TODO: DELETE + log.enabled = false // showCode(c.macroApplication).contains("DEBUG") log.header() val rewriteAttempt = diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala index b210f52bc..dbdb43386 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala @@ -1,12 +1,19 @@ package japgolly.scalajs.react.hooks -import japgolly.microlibs.compiletime.MacroEnv._ -import japgolly.scalajs.react.{Children, CtorType} +import japgolly.microlibs.compiletime.MacroEnv.* +import japgolly.scalajs.react.{Children, CtorType, PropsChildren, Reusability} +import japgolly.scalajs.react.component.{JsFn, ScalaFn} import japgolly.scalajs.react.component.ScalaFn.Component -import japgolly.scalajs.react.hooks.Api._ -import japgolly.scalajs.react.internal.Box +import japgolly.scalajs.react.facade +import japgolly.scalajs.react.facade.React +import japgolly.scalajs.react.hooks.Api.* +import japgolly.scalajs.react.hooks.HookCtx +import japgolly.scalajs.react.internal.{Box, MacroLogger} import japgolly.scalajs.react.vdom.VdomNode +import scala.annotation._ +import scala.language.`3.1` import scala.quoted.* +import scala.reflect.ClassTag import scala.scalajs.js object HookMacros { @@ -21,6 +28,110 @@ object HookMacros { // =================================================================================================================== + private def HookMacrosImpl(qq: Quotes): HookMacrosImpl { val q: qq.type } = + new HookMacrosImpl { + override implicit val q: qq.type = qq + import q.reflect.* + + override def rewriter(rctx: RewriterCtx): Rewriter = + new AbstractHookMacros.HookRewriter[Stmt, Term, HookRef] { + override protected val ctx = rctx + override protected def Apply(t: Term, as: List[Term]) = q.reflect.Apply(t, as) + override protected def hookRefToTerm(r: HookRef) = r.ref + override def valDef(n: String, t: Term) = { val r = untypedValDef(n, t.tpe, Flags.EmptyFlags)(t); this += r.valDef; r } + override def wrap(body: Term) = Block(stmts.toList, body) + + override protected def hookCtx(withChildren: Boolean, args: List[Term]) = { + val obj = if (withChildren) '{HookCtx.withChildren} else '{HookCtx} + Select.overloaded(obj.asTerm, "apply", args.map(_.tpe), args) + } + } + } + + @nowarn("msg=Consider using canonical type reference .+Underlying instead") + private trait HookMacrosImpl extends AbstractHookMacros { + import AbstractHookMacros._ + + implicit val q: Quotes + import q.reflect.* + + override type Expr[A] = scala.quoted.Expr[A] + override type HookRef = UntypedValDef.WithQuotes[q.type] + override type Stmt = q.reflect.Statement + override type Term = q.reflect.Term + override type Type[A] = scala.quoted.Type[A] + override type TypeTree = q.reflect.TypeTree + + override protected def asTerm[A](e: Expr[A]) = e.asTerm + override protected def Expr[A](t: Term) = t.asExprOf[Any].asInstanceOf[Expr[A]] + override protected def hookRefToTerm(r: HookRef) = r.ref + override protected def Type[A](t: TypeTree) = { + val x: scala.quoted.Type[?] = t.asType + x.asInstanceOf[scala.quoted.Type[A]] + } + + override val ApplyLike = new ApplyExtractor { + override def unapply(a: Term) = a match { + case Apply(x, y) => Some((x, y)) + case _ => None + } + } + + override val TypeApplyLike = new TypeApplyExtractor { + override def unapply(a: Term) = a match { + case TypeApply(x, y) => Some((x, y)) + case _ => None + } + } + + override val SelectLike = new SelectExtractor { + override def unapply(a: Term) = a match { + case Select(x, y) => Some((x, y)) + case _ => None + } + } + + override val FunctionLike = new FunctionExtractor { + override def unapply(function: Term) = function match { + case Block(List(DefDef(_, List(TermParamClause(params)), _, Some(_))), Closure(Ident(_), _)) => + Some(params.size) + case _ => + None + } + } + + override def showRaw(t: Term): String = t.show(using q.reflect.Printer.TreeStructure) + override def showCode(t: Term): String = t.show(using q.reflect.Printer.TreeShortCode) + + @tailrec + private def extractFunction(term: Term): Term = + term match { + case Inlined(None, Nil, f) => extractFunction(f) + case Block(Nil, expr) => extractFunction(expr) + case f => f + } + + override def call(function: Term, args: List[Term]): Term = { + val f = extractFunction(function) + val t = Apply(Select.unique(f, "apply"), args) + Term.betaReduce(t).getOrElse(t) + } + + override protected def useStateFn[S] = implicit (tpe, body) => + '{ React.useStateFn(() => Box[$tpe]($body)) } + + override protected def useStateFromJsBoxed[S] = implicit (tpe, raw) => + '{ Hooks.UseState.fromJsBoxed[$tpe]($raw) } + + override protected def useStateWithReuseFromJsBoxed[S] = implicit (tpe, raw, reuse, ct) => + '{ Hooks.UseStateWithReuse.fromJsBoxed[$tpe]($raw)($reuse, $ct) } + + override protected def vdomRawNode = vdom => + '{ $vdom.rawNode } + } + + // =================================================================================================================== + // https://github.com/lampepfl/dotty/issues/15357 inline def renderWorkaround[ P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u] @@ -36,27 +147,52 @@ object HookMacros { f : Expr[CtxFn[VdomNode]], step : Expr[Step], s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], - )(using Quotes, Type[P], Type[C], Type[CT], Type[Ctx], Type[CtxFn], Type[Step]): Expr[Component[P, CT]] = { + )(using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], CtxFn: Type[CtxFn], Step: Type[Step]): Expr[Component[P, CT]] = { import quotes.reflect.* - var debug = false // showCode(c.macroApplication).contains("counter.value") + val hookMacros = HookMacrosImpl(q) + import hookMacros.{log, HookStep} - def println(args: Any*): Unit = - if (debug) System.out.println(args.mkString) + log.enabled = false // f.show.contains("DEBUG") + log.header() - println("="*120) - println() + val renderStep = + HookStep("render", Nil, List(List(f.asTerm), List(step.asTerm, s.asTerm))) - val result: Expr[Component[P, CT]] = - '{ $self.render($step.squash($f)(_))($s) } - - if (debug) - println("RESULT:\n" + result.show) - - println() - println("="*120) + val rewriteAttempt = + for { + p <- hookMacros.parse(self.asTerm.underlying) + r <- hookMacros.rewriteComponent(p + renderStep) + } yield hookMacros.applyRewrite(r) + val result: Expr[Component[P, CT]] = + rewriteAttempt match { + + case Right(rewrite) => + type JsProps = Box[P] with facade.PropsWithChildren + + def newBody(props: Expr[JsProps]): Expr[React.Node] = { + val children = typedValDef[PropsChildren]("children", Flags.EmptyFlags)('{ PropsChildren.fromRawProps($props) }) + val ctx = hookMacros.rewriterCtx( + props = '{ $props.unbox }.asTerm, + initChildren = children.valDef, + children = children.ref.asTerm, + ) + rewrite(ctx) + } + + '{ + val rawComponent: JsFn.RawComponent[Box[P]] = props => ${newBody('props)} + ScalaFn.fromBoxed(JsFn.fromJsFn[Box[P], C](rawComponent)($s)) + } + + case Left(err) => + log("Rewrite failure", err()) // TODO: make a proper warning? + '{ $self.render($step.squash($f)(_))($s) } + } + + log.footer(result.show) result } diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala index d541068e1..44b8bc779 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala @@ -48,7 +48,7 @@ object AbstractHookMacros { protected val ctx: HookRewriterCtx[Stmt, Term] protected def Apply(t: Term, args: List[Term]): Term - protected def hookCtx(withChildren: Boolean): Term + protected def hookCtx(withChildren: Boolean, args: List[Term]): Term protected def hookRefToTerm(ref: HookRef): Term final override def usesChildren() = @@ -80,8 +80,7 @@ object AbstractHookMacros { ctx.props :: hooks final override def ctxArg(): Term = { - val hookCtxObj = hookCtx(usesChildren()) - val create = Apply(hookCtxObj, args()) + val create = hookCtx(usesChildren(), args()) val ctx = valDef(create, "_ctx") hookRefToTerm(ctx) } @@ -158,7 +157,10 @@ trait AbstractHookMacros { implicit val log: MacroLogger = MacroLogger() - case class HookDefn(steps: List[HookStep]) + case class HookDefn(steps: List[HookStep]) { + def +(s: HookStep): HookDefn = + HookDefn(steps ::: s :: Nil) + } case class HookStep(name: String, targs: List[TypeTree], args: List[List[Term]]) diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out3.js new file mode 100644 index 000000000..68f41c576 --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out3.js @@ -0,0 +1,102 @@ +'use strict'; + +import * as $i_react from "react"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024package$0024PropsChildren$0024 from "./japgolly.scalajs.react.PropsChildren$package$PropsChildren$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusability from "./japgolly.scalajs.react.Reusability.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary from "./japgolly.scalajs.react.hooks.Api$Primary.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024 from "./japgolly.scalajs.react.hooks.HookComponentBuilder$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentPC$0024FirstStep from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentPC$FirstStep.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentPC$0024Subsequent from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentPC$Subsequent.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.Hooks$$anon$2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; +import * as $j_japgolly$002escalajs$002ereact$002epackage$0024 from "./japgolly.scalajs.react.package$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024 from "./japgolly.scalajs.react.vdom.Attr$EventCallback$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite from "./japgolly.scalajs.react.vdom.TagLite.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagMod from "./japgolly.scalajs.react.vdom.TagMod.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002eFunction1 from "./scala.Function1.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; + +function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$() { + var _s = $RefreshSig$(); + + this.Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$__f_Component = null; + $n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$ = this; + var this$4 = ($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$(), $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024.$m_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$().apply__Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$First()).withPropsChildren__Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentPC$First(); + var initialState = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => 123); + var step = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentPC$0024FirstStep.$c_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentPC$FirstStep(); + $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentPC$0024Subsequent.$as_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentPC$Subsequent($j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useState__F0__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$4, initialState, step)); + + var rawComponent = props => { + _s(); + + var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024package$0024PropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$package$PropsChildren$().fromRawProps__sjs_js_Object__O(props); + var hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); + var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); + var p = $j_java$002elang$002eObject.$uI(props.a); + var sum = (p + $j_java$002elang$002eObject.$uI(hook1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0) + $j_java$002elang$002eObject.$uI($i_react.Children.count(children)) | 0; + var this$18 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self = "button"; + var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((hook1$2 => () => { + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(hook1$2); + var ev$1 = $j_scala$002eFunction1.$as_F1(r.value__O()).apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$1 => { + var _$1$1 = $j_java$002elang$002eObject.$uI(_$1); + + return 1 + _$1$1 | 0; + })); + return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(ev$1 === null ? null : $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$as_Ljapgolly_scalajs_react_callback_CallbackTo(ev$1).Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline); + })(hook1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(children))])); + var this$19 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$18, self, xs); + return this$19.rawElement__Ljapgolly_scalajs_react_facade_React$Element(); + }; + + _s(rawComponent, "+3ihSvpsaY0Wt3tAhbVZmTm3dGg="); + + var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$20 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonPC__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); + this.Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$20.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$ }; +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$; + +function $h_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$ }; +$h_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$.prototype; +var $d_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$: 0 +}, false, "japgolly.scalajs.react.test.emissions.HooksWithChildren$", { + Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$ }; +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$; +var $n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$; + +function $m_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$) { + $n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$ = new $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out3.js new file mode 100644 index 000000000..a24cf3919 --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out3.js @@ -0,0 +1,140 @@ +'use strict'; + +import * as $i_react from "react"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusability from "./japgolly.scalajs.react.Reusability.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary from "./japgolly.scalajs.react.hooks.Api$Primary.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Secondary from "./japgolly.scalajs.react.hooks.Api$Secondary.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00241 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024 from "./japgolly.scalajs.react.hooks.HookComponentBuilder$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024FirstStep from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentP$FirstStep.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024Subsequent from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentP$Subsequent.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2 from "./japgolly.scalajs.react.hooks.HookCtx$P2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.Hooks$$anon$2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; +import * as $j_japgolly$002escalajs$002ereact$002epackage$0024 from "./japgolly.scalajs.react.package$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024 from "./japgolly.scalajs.react.vdom.Attr$EventCallback$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite from "./japgolly.scalajs.react.vdom.TagLite.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagMod from "./japgolly.scalajs.react.vdom.TagMod.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002eFunction1 from "./scala.Function1.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction2 from "./scala.scalajs.runtime.AnonFunction2.js"; + +function $c_Ljapgolly_scalajs_react_test_emissions_UseState$() { + var _s = $RefreshSig$(); + + this.Ljapgolly_scalajs_react_test_emissions_UseState$__f_Component = null; + $n_Ljapgolly_scalajs_react_test_emissions_UseState$ = this; + $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$(); + var this$4 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024.$m_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$().apply__Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$First(); + var initialState = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => 123); + var step = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024FirstStep.$c_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$FirstStep(); + var this$6 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Secondary.$as_Ljapgolly_scalajs_react_hooks_Api$Secondary($j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useState__F0__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$4, initialState, step)); + var initialState$1 = new $j_scala$002escalajs$002eruntime$002eAnonFunction2.$c_sjsr_AnonFunction2((p, s1) => { + var p$1 = $j_java$002elang$002eObject.$uI(p); + var s1$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(s1); + return p$1 + $j_java$002elang$002eObject.$uI(s1$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0; + }); + var step$1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$1(); + var this$10 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$as_Ljapgolly_scalajs_react_hooks_Api$Primary($j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Secondary.$f_Ljapgolly_scalajs_react_hooks_Api$Secondary__useStateBy__O__Ljapgolly_scalajs_react_hooks_Api$SubsequentStep__O(this$6, initialState$1, step$1)); + var initialState$2 = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(δ => { + var δ$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$as_Ljapgolly_scalajs_react_hooks_HookCtx$P2(δ); + var $$x2 = $j_java$002elang$002eObject.$uI(δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props); + var this$7 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1); + var $$x1 = $j_java$002elang$002eObject.$uI(this$7.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); + var this$8 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2); + return ($$x2 + $$x1 | 0) + $j_java$002elang$002eObject.$uI(this$8.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0; + }); + var step$2 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00242.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$2(); + $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024Subsequent.$as_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$Subsequent($j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useStateBy__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$10, initialState$2, step$2)); + + var rawComponent = props => { + _s(); + + var hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); + var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); + var hook2_raw = $i_react.useState(((props$2, hook1$2) => () => { + var $$x3 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); + var p$2 = $j_java$002elang$002eObject.$uI(props$2.a); + return $$x3.apply__O__Ljapgolly_scalajs_react_internal_Box(p$2 + $j_java$002elang$002eObject.$uI(hook1$2.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0); + })(props, hook1)); + var hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); + var props$1 = props.a; + var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, hook1, hook2); + var hook3_raw = $i_react.useState((hook3_ctx$2 => () => { + var $$x6 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); + var $$x5 = $j_java$002elang$002eObject.$uI(hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props); + var this$13 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1); + var $$x4 = $j_java$002elang$002eObject.$uI(this$13.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); + var this$14 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2); + return $$x6.apply__O__Ljapgolly_scalajs_react_internal_Box(($$x5 + $$x4 | 0) + $j_java$002elang$002eObject.$uI(this$14.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0); + })(hook3_ctx)); + var hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); + $j_java$002elang$002eObject.$uI(props.a); + var sum = ($j_java$002elang$002eObject.$uI(hook1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) + $j_java$002elang$002eObject.$uI(hook2.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0) + $j_java$002elang$002eObject.$uI(hook3.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0; + var this$23 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self = "button"; + var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((hook1$3 => () => { + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(hook1$3); + var ev$1 = $j_scala$002eFunction1.$as_F1(r.value__O()).apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$2 => { + var _$2$1 = $j_java$002elang$002eObject.$uI(_$2); + + return 1 + _$2$1 | 0; + })); + return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(ev$1 === null ? null : $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$as_Ljapgolly_scalajs_react_callback_CallbackTo(ev$1).Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline); + })(hook1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)])); + var this$24 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$23, self, xs); + return this$24.rawElement__Ljapgolly_scalajs_react_facade_React$Element(); + }; + + _s(rawComponent, "ua6eMzabMXKN9f38Hp0jS9R7o6c="); + + var $$x7 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$25 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); + this.Ljapgolly_scalajs_react_test_emissions_UseState$__f_Component = $$x7.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$25.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_UseState$ }; +$c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_UseState$; + +function $h_Ljapgolly_scalajs_react_test_emissions_UseState$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_UseState$ }; +$h_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype; +var $d_Ljapgolly_scalajs_react_test_emissions_UseState$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_UseState$: 0 +}, false, "japgolly.scalajs.react.test.emissions.UseState$", { + Ljapgolly_scalajs_react_test_emissions_UseState$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_UseState$ }; +$c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_UseState$; +var $n_Ljapgolly_scalajs_react_test_emissions_UseState$; + +function $m_Ljapgolly_scalajs_react_test_emissions_UseState$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_UseState$) { + $n_Ljapgolly_scalajs_react_test_emissions_UseState$ = new $c_Ljapgolly_scalajs_react_test_emissions_UseState$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_UseState$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_UseState$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out3.js new file mode 100644 index 000000000..9e382ba6f --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out3.js @@ -0,0 +1,177 @@ +'use strict'; + +import * as $i_react from "react"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusability from "./japgolly.scalajs.react.Reusability.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary from "./japgolly.scalajs.react.hooks.Api$Primary.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00241 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024 from "./japgolly.scalajs.react.hooks.HookComponentBuilder$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024FirstStep from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentP$FirstStep.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024Subsequent from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentP$Subsequent.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2 from "./japgolly.scalajs.react.hooks.HookCtx$P2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.Hooks$$anon$2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuse$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseStateWithReuse$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF from "./japgolly.scalajs.react.hooks.Hooks$UseStateWithReuseF.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; +import * as $j_japgolly$002escalajs$002ereact$002epackage$0024 from "./japgolly.scalajs.react.package$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024 from "./japgolly.scalajs.react.vdom.Attr$EventCallback$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite from "./japgolly.scalajs.react.vdom.TagLite.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagMod from "./japgolly.scalajs.react.vdom.TagMod.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002eFunction1 from "./scala.Function1.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction2 from "./scala.scalajs.runtime.AnonFunction2.js"; + +function $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$() { + var _s = $RefreshSig$(); + + this.Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$__f_Component = null; + $n_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$ = this; + $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$(); + var this$8 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024.$m_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$().apply__Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$First(); + var initialState = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => 123); + var evidence$2 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var this$6 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var evidence$3 = this$6.by_$eq$eq__F2(); + var step = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024FirstStep.$c_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$FirstStep(); + var initialState$1 = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1((initialState$2 => _$36 => initialState$2.apply__O())(initialState)); + var f = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((initialState$2$1, evidence$4$2, evidence$5$2) => ctx => $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuse$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuse$().unsafeCreate__F0__F2__s_reflect_ClassTag__Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((initialState$8$2, ctx$2) => () => initialState$8$2.apply__O__O(ctx$2))(initialState$2$1, ctx)), evidence$5$2, evidence$4$2))(initialState$1, evidence$2, evidence$3)); + var this$18 = this$8.next__F1__Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$FirstStep__Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$Subsequent(f, step); + var initialState$3 = new $j_scala$002escalajs$002eruntime$002eAnonFunction2.$c_sjsr_AnonFunction2((p, s1) => { + var p$1 = $j_java$002elang$002eObject.$uI(p); + var s1$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(s1); + var this$12 = s1$1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + return p$1 + $j_java$002elang$002eObject.$uI(this$12.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0; + }); + var evidence$6 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var this$16 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var evidence$7 = this$16.by_$eq$eq__F2(); + var step$1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$1(); + var initialState$4 = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((initialState$2$2, step$2) => _$62 => $j_scala$002eFunction1.$as_F1(step$2.squash__F1().apply__O__O(initialState$2$2)).apply__O__O(_$62))(initialState$3, step$1)); + var f$1 = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((initialState$2$3, evidence$4$2$1, evidence$5$2$1) => ctx$1 => $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuse$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuse$().unsafeCreate__F0__F2__s_reflect_ClassTag__Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((initialState$8$2$1, ctx$2$1) => () => initialState$8$2$1.apply__O__O(ctx$2$1))(initialState$2$3, ctx$1)), evidence$5$2$1, evidence$4$2$1))(initialState$4, evidence$6, evidence$7)); + var this$31 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$as_Ljapgolly_scalajs_react_hooks_Api$Primary(this$18.next__F1__Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$SubsequentStep__O(f$1, step$1)); + var initialState$5 = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(δ => { + var δ$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$as_Ljapgolly_scalajs_react_hooks_HookCtx$P2(δ); + var $$x2 = $j_java$002elang$002eObject.$uI(δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props); + var this$22 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1); + var this$23 = this$22.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var $$x1 = $j_java$002elang$002eObject.$uI(this$23.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); + var this$24 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2); + var this$25 = this$24.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + return ($$x2 + $$x1 | 0) + $j_java$002elang$002eObject.$uI(this$25.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0; + }); + var evidence$4 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var this$29 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var evidence$5 = this$29.by_$eq$eq__F2(); + var step$3 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00242.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$2(); + $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024Subsequent.$as_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$Subsequent(this$31.next__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((initialState$2$4, evidence$4$2$2, evidence$5$2$2) => ctx$3 => $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuse$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuse$().unsafeCreate__F0__F2__s_reflect_ClassTag__Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((initialState$8$2$2, ctx$2$2) => () => initialState$8$2$2.apply__O__O(ctx$2$2))(initialState$2$4, ctx$3)), evidence$5$2$2, evidence$4$2$2))(initialState$5, evidence$4, evidence$5)), step$3)); + + var rawComponent = props => { + _s(); + + var hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); + var this$35 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var r = this$35.by_$eq$eq__F2(); + var ct = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var rr = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r); + var this$40 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); + var us = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$40, r); + var hook1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us, rr, ct); + var hook2_raw = $i_react.useState(((props$2, hook1$2) => () => { + var $$x3 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); + var p$2 = $j_java$002elang$002eObject.$uI(props$2.a); + var this$42 = hook1$2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + return $$x3.apply__O__Ljapgolly_scalajs_react_internal_Box(p$2 + $j_java$002elang$002eObject.$uI(this$42.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0); + })(props, hook1)); + var this$43 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var r$1 = this$43.by_$eq$eq__F2(); + var ct$1 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var rr$1 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r$1); + var this$48 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); + var us$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$48, r$1); + var hook2 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us$1, rr$1, ct$1); + var props$1 = props.a; + var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, hook1, hook2); + var hook3_raw = $i_react.useState((hook3_ctx$2 => () => { + var $$x6 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); + var $$x5 = $j_java$002elang$002eObject.$uI(hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props); + var this$51 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1); + var this$52 = this$51.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var $$x4 = $j_java$002elang$002eObject.$uI(this$52.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); + var this$53 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2); + var this$54 = this$53.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + return $$x6.apply__O__Ljapgolly_scalajs_react_internal_Box(($$x5 + $$x4 | 0) + $j_java$002elang$002eObject.$uI(this$54.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0); + })(hook3_ctx)); + var this$55 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var r$2 = this$55.by_$eq$eq__F2(); + var ct$2 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var rr$2 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r$2); + var this$60 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); + var us$2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$60, r$2); + var hook3 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us$2, rr$2, ct$2); + $j_java$002elang$002eObject.$uI(props.a); + var this$62 = hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var $$x8 = $j_java$002elang$002eObject.$uI(this$62.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); + var this$63 = hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var $$x7 = $j_java$002elang$002eObject.$uI(this$63.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); + var this$64 = hook3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var sum = ($$x8 + $$x7 | 0) + $j_java$002elang$002eObject.$uI(this$64.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0; + var this$72 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self = "button"; + var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("DEBUG = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((hook1$3 => () => hook1$3.modState__F1__Ljapgolly_scalajs_react_Reusable(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$2 => { + var _$2$1 = $j_java$002elang$002eObject.$uI(_$2); + + return 1 + _$2$1 | 0; + })))(hook1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().reusableDefaultSync__F1())])); + var this$73 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$72, self, xs); + return this$73.rawElement__Ljapgolly_scalajs_react_facade_React$Element(); + }; + + _s(rawComponent, "IWUf6wx8RInLzShmnpth33nvXy0="); + + var $$x9 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$74 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); + this.Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$__f_Component = $$x9.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$74.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$ }; +$c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$; + +function $h_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$ }; +$h_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$.prototype; +var $d_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$: 0 +}, false, "japgolly.scalajs.react.test.emissions.UseStateWithReuse$", { + Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$ }; +$c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$; +var $n_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$; + +function $m_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$) { + $n_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$ = new $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$ }; From 3bc3af9298273df82284156669b1ba1f24365192 Mon Sep 17 00:00:00 2001 From: David Barri Date: Thu, 9 Jun 2022 16:36:37 +1000 Subject: [PATCH 25/72] Silence macrotasks warnings in downstream-tests --- downstream-tests/build.sbt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/downstream-tests/build.sbt b/downstream-tests/build.sbt index 134a30894..8b6763176 100644 --- a/downstream-tests/build.sbt +++ b/downstream-tests/build.sbt @@ -14,11 +14,12 @@ def scalacCommonFlags: Seq[String] = Seq( "-language:higherKinds", "-language:existentials", "-unchecked", + "-Wconf:msg=may.not.be.exhaustive:e", // Make non-exhaustive matches errors instead of warnings + "-Wconf:msg=Reference.to.uninitialized.value:e", // Make uninitialised value calls errors instead of warnings + "-Wconf:msg=macrotask:s", // stfu about macrotasks ) def scalac2Flags = Seq( - "-Wconf:msg=may.not.be.exhaustive:e", // Make non-exhaustive matches errors instead of warnings - "-Wconf:msg=Reference.to.uninitialized.value:e", // Make uninitialised value calls errors instead of warnings "-Wunused:explicits", // Warn if an explicit parameter is unused. "-Wunused:implicits", // Warn if an implicit parameter is unused. "-Wunused:imports", // Warn if an import selector is not referenced. From 9425f1654e4a8b305d67f4d8577e9f82328b14dc Mon Sep 17 00:00:00 2001 From: David Barri Date: Thu, 9 Jun 2022 16:36:49 +1000 Subject: [PATCH 26/72] Make SNAPSHOT versions stable --- downstream-tests/version.sbt | 1 + library/version.sbt | 5 +++++ 2 files changed, 6 insertions(+) create mode 120000 downstream-tests/version.sbt create mode 100644 library/version.sbt diff --git a/downstream-tests/version.sbt b/downstream-tests/version.sbt new file mode 120000 index 000000000..a0eac248e --- /dev/null +++ b/downstream-tests/version.sbt @@ -0,0 +1 @@ +../library/version.sbt \ No newline at end of file diff --git a/library/version.sbt b/library/version.sbt new file mode 100644 index 000000000..df188c14c --- /dev/null +++ b/library/version.sbt @@ -0,0 +1,5 @@ +// Remove timestamp from SNAPSHOT versions +ThisBuild / version := { + val v = (ThisBuild / version).value + v.replaceFirst("""\+\d{8}-\d{4}(?=-SNAPSHOT)""", "") +} From fd38f4b36e3959d5271ba02dc9329289662fb1d4 Mon Sep 17 00:00:00 2001 From: David Barri Date: Fri, 10 Jun 2022 11:43:47 +1000 Subject: [PATCH 27/72] Give up trying to preserve bincompat --- .../scalajs/react/hooks/HookMacros.scala | 13 ++++++- .../scalajs/react/hooks/HookMacros copy.scala | 33 ++++++++++++++++ .../scalajs/react/hooks/HookMacros.scala | 11 +++++- .../japgolly/scalajs/react/hooks/Api.scala | 38 +++++++++++++++++-- .../react/hooks/HookComponentBuilder.scala | 4 +- 5 files changed, 91 insertions(+), 8 deletions(-) create mode 100644 library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros copy.scala diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala index c1cd819d4..dc4203bf3 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -10,10 +10,19 @@ import scala.reflect.macros.blackbox.Context object HookMacros { - trait ApiSecondaryWithRenderMacros[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] { + trait ApiSecondaryWithRenderMacros200[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] { self: PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step] => - final def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = + def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = + render(step.squash(f)(_)) + } + + trait ApiSecondaryWithRenderMacros[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] + extends ApiSecondaryWithRenderMacros200[P, C, Ctx, CtxFn, Step] + { + self: PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step] => + + final override def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = // Without macros: render(step.squash(f)(_)) macro HookMacros.render[P, C, Ctx, CtxFn, Step] } diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros copy.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros copy.scala new file mode 100644 index 000000000..1a6b0b2f9 --- /dev/null +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros copy.scala @@ -0,0 +1,33 @@ +package japgolly.scalajs.react.hooks + +import japgolly.microlibs.compiletime.MacroEnv.* +import japgolly.scalajs.react.{Children, CtorType, PropsChildren, Reusability} +import japgolly.scalajs.react.component.{JsFn, ScalaFn} +import japgolly.scalajs.react.component.ScalaFn.Component +import japgolly.scalajs.react.facade +import japgolly.scalajs.react.facade.React +import japgolly.scalajs.react.hooks.Api.* +import japgolly.scalajs.react.hooks.HookCtx +import japgolly.scalajs.react.internal.{Box, MacroLogger} +import japgolly.scalajs.react.vdom.VdomNode +import scala.annotation._ +import scala.quoted.* +import scala.reflect.ClassTag +import scala.scalajs.js + +// // trait ApiSecondaryWithRenderMacros200[P, C <: Children, Ctx, CtxFn[_], _Step <: SubsequentStep[Ctx, CtxFn]] { +// // self: PrimaryWithRender[P, C, Ctx, _Step] with Secondary[Ctx, CtxFn, _Step] => + +// // def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = +// // render(step.squash(f)(_)) +// // } + +// trait ApiSecondaryWithRenderMacros[P, C <: Children, Ctx, CtxFn[_], _Step <: SubsequentStep[Ctx, CtxFn]] +// // extends ApiSecondaryWithRenderMacros200[P, C, Ctx, CtxFn, _Step] +// { +// self: PrimaryWithRender[P, C, Ctx, _Step] with Secondary[Ctx, CtxFn, _Step] => + +// inline final def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = +// // Without macros: render(step.squash(f)(_)) +// HookMacros.renderWorkaround[P, C, Ctx, CtxFn, Step, s.CT](this, f, step, s) +// } diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala index dbdb43386..e5b1a210c 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala @@ -18,7 +18,16 @@ import scala.scalajs.js object HookMacros { - trait ApiSecondaryWithRenderMacros[P, C <: Children, Ctx, CtxFn[_], _Step <: SubsequentStep[Ctx, CtxFn]] { + // trait ApiSecondaryWithRenderMacros200[P, C <: Children, Ctx, CtxFn[_], _Step <: SubsequentStep[Ctx, CtxFn]] { + // self: PrimaryWithRender[P, C, Ctx, _Step] with Secondary[Ctx, CtxFn, _Step] => + + // def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = + // render(step.squash(f)(_)) + // } + + trait ApiSecondaryWithRenderMacros[P, C <: Children, Ctx, CtxFn[_], _Step <: SubsequentStep[Ctx, CtxFn]] + // extends ApiSecondaryWithRenderMacros200[P, C, Ctx, CtxFn, _Step] + { self: PrimaryWithRender[P, C, Ctx, _Step] with Secondary[Ctx, CtxFn, _Step] => inline final def render(inline f: CtxFn[VdomNode])(implicit inline step: Step, inline s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Api.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Api.scala index 3e2eebbc8..1b2da0fcf 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Api.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Api.scala @@ -690,12 +690,12 @@ object Api { def renderWithReuseBy[A](reusableInputs: Ctx => A)(f: A => VdomNode)(implicit s: CtorType.Summoner[Box[P], C], r: Reusability[A]): Component[P, s.CT] } - trait SecondaryWithRender[P, C <: Children, Ctx, CtxFn[_], _Step <: SubsequentStep[Ctx, CtxFn]] extends PrimaryWithRender[P, C, Ctx, _Step] with Secondary[Ctx, CtxFn, _Step] with HookMacros.ApiSecondaryWithRenderMacros[P, C, Ctx, CtxFn, _Step] { + trait SecondaryWithRender[P, C <: Children, Ctx, CtxFn[_], _Step <: SubsequentStep[Ctx, CtxFn]] extends PrimaryWithRender[P, C, Ctx, _Step] with Secondary[Ctx, CtxFn, _Step] { // This has been moved into HookMacros.ApiSecondaryWithRenderMacros // - // final def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = - // render(step.squash(f)(_)) + def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = + render(step.squash(f)(_)) final def renderReusable[A](f: CtxFn[Reusable[A]])(implicit step: Step, s: CtorType.Summoner[Box[P], C], v: A => VdomNode): Component[P, s.CT] = renderReusable(step.squash(f)(_)) @@ -706,4 +706,36 @@ object Api { final def renderWithReuseBy[A](reusableInputs: CtxFn[A])(f: A => VdomNode)(implicit step: Step, s: CtorType.Summoner[Box[P], C], r: Reusability[A]): Component[P, s.CT] = renderWithReuseBy(step.squash(reusableInputs)(_))(f) } + + // trait SecondaryWithRender2[P, C <: Children, Ctx, CtxFn[_], _Step <: SubsequentStep[Ctx, CtxFn]] extends PrimaryWithRender[P, C, Ctx, _Step] with Secondary[Ctx, CtxFn, _Step] with HookMacros.ApiSecondaryWithRenderMacros[P, C, Ctx, CtxFn, _Step] { + + // // This has been moved into HookMacros.ApiSecondaryWithRenderMacros + // // + // // final def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = + // // render(step.squash(f)(_)) + + // final def renderReusable[A](f: CtxFn[Reusable[A]])(implicit step: Step, s: CtorType.Summoner[Box[P], C], v: A => VdomNode): Component[P, s.CT] = + // renderReusable(step.squash(f)(_)) + + // final def renderWithReuse(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C], r: Reusability[Ctx]): Component[P, s.CT] = + // renderWithReuse(step.squash(f)(_)) + + // final def renderWithReuseBy[A](reusableInputs: CtxFn[A])(f: A => VdomNode)(implicit step: Step, s: CtorType.Summoner[Box[P], C], r: Reusability[A]): Component[P, s.CT] = + // renderWithReuseBy(step.squash(reusableInputs)(_))(f) + // } + + trait SecondaryWithRender2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] + extends SecondaryWithRender[P, C, Ctx, CtxFn, Step] + // with HookMacros.ApiSecondaryWithRenderMacros[P, C, Ctx, CtxFn, Step] + + @inline final class PoopyMcFartFace[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]]( + self: SecondaryWithRender2[P, C, Ctx, CtxFn, Step]) extends AnyVal { + + // def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = + // self.render(f) + + inline def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = + // Without macros: render(step.squash(f)(_)) + HookMacros.renderWorkaround[P, C, Ctx, CtxFn, Step, s.CT](self, f, step, s) + } } diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/HookComponentBuilder.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/HookComponentBuilder.scala index 5b35e50d1..78a426663 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/HookComponentBuilder.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/HookComponentBuilder.scala @@ -37,7 +37,7 @@ object HookComponentBuilder { type RenderFn[-P, +Ctx] = (Ctx => VdomNode) => P => VdomNode - final class Subsequent[P, Ctx, CtxFn[_]](renderFn: RenderFn[P, Ctx]) extends Api.SecondaryWithRender[P, Children.None, Ctx, CtxFn, SubsequentStep[P, Ctx, CtxFn]] { + final class Subsequent[P, Ctx, CtxFn[_]](renderFn: RenderFn[P, Ctx]) extends Api.SecondaryWithRender2[P, Children.None, Ctx, CtxFn, SubsequentStep[P, Ctx, CtxFn]] { override protected def self(f: Ctx => Any)(implicit step: Step): step.Self = step.self(renderFn, f) @@ -129,7 +129,7 @@ object HookComponentBuilder { type RenderFn[-P, +Ctx] = (Ctx => VdomNode) => (P, PropsChildren) => VdomNode - final class Subsequent[P, Ctx, CtxFn[_]](renderFn: RenderFn[P, Ctx]) extends Api.SecondaryWithRender[P, Children.Varargs, Ctx, CtxFn, SubsequentStep[P, Ctx, CtxFn]] { + final class Subsequent[P, Ctx, CtxFn[_]](renderFn: RenderFn[P, Ctx]) extends Api.SecondaryWithRender2[P, Children.Varargs, Ctx, CtxFn, SubsequentStep[P, Ctx, CtxFn]] { override protected def self(f: Ctx => Any)(implicit step: Step): step.Self = step.self(renderFn, f) From 11f0cf553e5c0558847c64f0c1bc9638daa5717b Mon Sep 17 00:00:00 2001 From: David Barri Date: Fri, 10 Jun 2022 11:44:50 +1000 Subject: [PATCH 28/72] Revert "Give up trying to preserve bincompat" This reverts commit fd38f4b36e3959d5271ba02dc9329289662fb1d4. --- .../scalajs/react/hooks/HookMacros.scala | 13 +------ .../scalajs/react/hooks/HookMacros copy.scala | 33 ---------------- .../scalajs/react/hooks/HookMacros.scala | 11 +----- .../japgolly/scalajs/react/hooks/Api.scala | 38 ++----------------- .../react/hooks/HookComponentBuilder.scala | 4 +- 5 files changed, 8 insertions(+), 91 deletions(-) delete mode 100644 library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros copy.scala diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala index dc4203bf3..c1cd819d4 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -10,19 +10,10 @@ import scala.reflect.macros.blackbox.Context object HookMacros { - trait ApiSecondaryWithRenderMacros200[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] { + trait ApiSecondaryWithRenderMacros[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] { self: PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step] => - def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = - render(step.squash(f)(_)) - } - - trait ApiSecondaryWithRenderMacros[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] - extends ApiSecondaryWithRenderMacros200[P, C, Ctx, CtxFn, Step] - { - self: PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step] => - - final override def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = + final def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = // Without macros: render(step.squash(f)(_)) macro HookMacros.render[P, C, Ctx, CtxFn, Step] } diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros copy.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros copy.scala deleted file mode 100644 index 1a6b0b2f9..000000000 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros copy.scala +++ /dev/null @@ -1,33 +0,0 @@ -package japgolly.scalajs.react.hooks - -import japgolly.microlibs.compiletime.MacroEnv.* -import japgolly.scalajs.react.{Children, CtorType, PropsChildren, Reusability} -import japgolly.scalajs.react.component.{JsFn, ScalaFn} -import japgolly.scalajs.react.component.ScalaFn.Component -import japgolly.scalajs.react.facade -import japgolly.scalajs.react.facade.React -import japgolly.scalajs.react.hooks.Api.* -import japgolly.scalajs.react.hooks.HookCtx -import japgolly.scalajs.react.internal.{Box, MacroLogger} -import japgolly.scalajs.react.vdom.VdomNode -import scala.annotation._ -import scala.quoted.* -import scala.reflect.ClassTag -import scala.scalajs.js - -// // trait ApiSecondaryWithRenderMacros200[P, C <: Children, Ctx, CtxFn[_], _Step <: SubsequentStep[Ctx, CtxFn]] { -// // self: PrimaryWithRender[P, C, Ctx, _Step] with Secondary[Ctx, CtxFn, _Step] => - -// // def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = -// // render(step.squash(f)(_)) -// // } - -// trait ApiSecondaryWithRenderMacros[P, C <: Children, Ctx, CtxFn[_], _Step <: SubsequentStep[Ctx, CtxFn]] -// // extends ApiSecondaryWithRenderMacros200[P, C, Ctx, CtxFn, _Step] -// { -// self: PrimaryWithRender[P, C, Ctx, _Step] with Secondary[Ctx, CtxFn, _Step] => - -// inline final def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = -// // Without macros: render(step.squash(f)(_)) -// HookMacros.renderWorkaround[P, C, Ctx, CtxFn, Step, s.CT](this, f, step, s) -// } diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala index e5b1a210c..dbdb43386 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala @@ -18,16 +18,7 @@ import scala.scalajs.js object HookMacros { - // trait ApiSecondaryWithRenderMacros200[P, C <: Children, Ctx, CtxFn[_], _Step <: SubsequentStep[Ctx, CtxFn]] { - // self: PrimaryWithRender[P, C, Ctx, _Step] with Secondary[Ctx, CtxFn, _Step] => - - // def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = - // render(step.squash(f)(_)) - // } - - trait ApiSecondaryWithRenderMacros[P, C <: Children, Ctx, CtxFn[_], _Step <: SubsequentStep[Ctx, CtxFn]] - // extends ApiSecondaryWithRenderMacros200[P, C, Ctx, CtxFn, _Step] - { + trait ApiSecondaryWithRenderMacros[P, C <: Children, Ctx, CtxFn[_], _Step <: SubsequentStep[Ctx, CtxFn]] { self: PrimaryWithRender[P, C, Ctx, _Step] with Secondary[Ctx, CtxFn, _Step] => inline final def render(inline f: CtxFn[VdomNode])(implicit inline step: Step, inline s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Api.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Api.scala index 1b2da0fcf..3e2eebbc8 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Api.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Api.scala @@ -690,12 +690,12 @@ object Api { def renderWithReuseBy[A](reusableInputs: Ctx => A)(f: A => VdomNode)(implicit s: CtorType.Summoner[Box[P], C], r: Reusability[A]): Component[P, s.CT] } - trait SecondaryWithRender[P, C <: Children, Ctx, CtxFn[_], _Step <: SubsequentStep[Ctx, CtxFn]] extends PrimaryWithRender[P, C, Ctx, _Step] with Secondary[Ctx, CtxFn, _Step] { + trait SecondaryWithRender[P, C <: Children, Ctx, CtxFn[_], _Step <: SubsequentStep[Ctx, CtxFn]] extends PrimaryWithRender[P, C, Ctx, _Step] with Secondary[Ctx, CtxFn, _Step] with HookMacros.ApiSecondaryWithRenderMacros[P, C, Ctx, CtxFn, _Step] { // This has been moved into HookMacros.ApiSecondaryWithRenderMacros // - def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = - render(step.squash(f)(_)) + // final def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = + // render(step.squash(f)(_)) final def renderReusable[A](f: CtxFn[Reusable[A]])(implicit step: Step, s: CtorType.Summoner[Box[P], C], v: A => VdomNode): Component[P, s.CT] = renderReusable(step.squash(f)(_)) @@ -706,36 +706,4 @@ object Api { final def renderWithReuseBy[A](reusableInputs: CtxFn[A])(f: A => VdomNode)(implicit step: Step, s: CtorType.Summoner[Box[P], C], r: Reusability[A]): Component[P, s.CT] = renderWithReuseBy(step.squash(reusableInputs)(_))(f) } - - // trait SecondaryWithRender2[P, C <: Children, Ctx, CtxFn[_], _Step <: SubsequentStep[Ctx, CtxFn]] extends PrimaryWithRender[P, C, Ctx, _Step] with Secondary[Ctx, CtxFn, _Step] with HookMacros.ApiSecondaryWithRenderMacros[P, C, Ctx, CtxFn, _Step] { - - // // This has been moved into HookMacros.ApiSecondaryWithRenderMacros - // // - // // final def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = - // // render(step.squash(f)(_)) - - // final def renderReusable[A](f: CtxFn[Reusable[A]])(implicit step: Step, s: CtorType.Summoner[Box[P], C], v: A => VdomNode): Component[P, s.CT] = - // renderReusable(step.squash(f)(_)) - - // final def renderWithReuse(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C], r: Reusability[Ctx]): Component[P, s.CT] = - // renderWithReuse(step.squash(f)(_)) - - // final def renderWithReuseBy[A](reusableInputs: CtxFn[A])(f: A => VdomNode)(implicit step: Step, s: CtorType.Summoner[Box[P], C], r: Reusability[A]): Component[P, s.CT] = - // renderWithReuseBy(step.squash(reusableInputs)(_))(f) - // } - - trait SecondaryWithRender2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] - extends SecondaryWithRender[P, C, Ctx, CtxFn, Step] - // with HookMacros.ApiSecondaryWithRenderMacros[P, C, Ctx, CtxFn, Step] - - @inline final class PoopyMcFartFace[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]]( - self: SecondaryWithRender2[P, C, Ctx, CtxFn, Step]) extends AnyVal { - - // def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = - // self.render(f) - - inline def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = - // Without macros: render(step.squash(f)(_)) - HookMacros.renderWorkaround[P, C, Ctx, CtxFn, Step, s.CT](self, f, step, s) - } } diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/HookComponentBuilder.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/HookComponentBuilder.scala index 78a426663..5b35e50d1 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/HookComponentBuilder.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/HookComponentBuilder.scala @@ -37,7 +37,7 @@ object HookComponentBuilder { type RenderFn[-P, +Ctx] = (Ctx => VdomNode) => P => VdomNode - final class Subsequent[P, Ctx, CtxFn[_]](renderFn: RenderFn[P, Ctx]) extends Api.SecondaryWithRender2[P, Children.None, Ctx, CtxFn, SubsequentStep[P, Ctx, CtxFn]] { + final class Subsequent[P, Ctx, CtxFn[_]](renderFn: RenderFn[P, Ctx]) extends Api.SecondaryWithRender[P, Children.None, Ctx, CtxFn, SubsequentStep[P, Ctx, CtxFn]] { override protected def self(f: Ctx => Any)(implicit step: Step): step.Self = step.self(renderFn, f) @@ -129,7 +129,7 @@ object HookComponentBuilder { type RenderFn[-P, +Ctx] = (Ctx => VdomNode) => (P, PropsChildren) => VdomNode - final class Subsequent[P, Ctx, CtxFn[_]](renderFn: RenderFn[P, Ctx]) extends Api.SecondaryWithRender2[P, Children.Varargs, Ctx, CtxFn, SubsequentStep[P, Ctx, CtxFn]] { + final class Subsequent[P, Ctx, CtxFn[_]](renderFn: RenderFn[P, Ctx]) extends Api.SecondaryWithRender[P, Children.Varargs, Ctx, CtxFn, SubsequentStep[P, Ctx, CtxFn]] { override protected def self(f: Ctx => Any)(implicit step: Step): step.Self = step.self(renderFn, f) From 02b1f18d2f0a38fb740829c276f1d71a046dc6f3 Mon Sep 17 00:00:00 2001 From: David Barri Date: Fri, 10 Jun 2022 12:46:50 +1000 Subject: [PATCH 29/72] Recover bincompat, turns out there was a node version issue --- .../scalajs/react/hooks/HookMacros.scala | 17 +-- .../react/hooks/HookMacrosTraits.scala | 22 +++ .../scalajs/react/hooks/HookMacros.scala | 10 -- .../react/hooks/HookMacrosTraits.scala | 31 ++++ .../japgolly/scalajs/react/hooks/Api.scala | 2 +- .../rr-sjr/HooksWithChildren-out3.js | 49 ++++--- .../test/resources/rr-sjr/UseState-out3.js | 85 ++++++----- .../rr-sjr/UseStateWithReuse-out3.js | 135 ++++++++++-------- 8 files changed, 202 insertions(+), 149 deletions(-) create mode 100644 library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacrosTraits.scala create mode 100644 library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala index c1cd819d4..43e154d8a 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -1,26 +1,11 @@ package japgolly.scalajs.react.hooks import japgolly.microlibs.compiletime.MacroUtils -import japgolly.scalajs.react.component.ScalaFn.Component import japgolly.scalajs.react.hooks.Api._ import japgolly.scalajs.react.internal.Box -import japgolly.scalajs.react.vdom.VdomNode -import japgolly.scalajs.react.{Children, CtorType} +import japgolly.scalajs.react.Children import scala.reflect.macros.blackbox.Context -object HookMacros { - - trait ApiSecondaryWithRenderMacros[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] { - self: PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step] => - - final def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = - // Without macros: render(step.squash(f)(_)) - macro HookMacros.render[P, C, Ctx, CtxFn, Step] - } -} - -// ===================================================================================================================== - class HookMacros(val c: Context) extends MacroUtils { import c.universe._ diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacrosTraits.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacrosTraits.scala new file mode 100644 index 000000000..ed17a1a18 --- /dev/null +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacrosTraits.scala @@ -0,0 +1,22 @@ +package japgolly.scalajs.react.hooks + +import japgolly.scalajs.react.component.ScalaFn.Component +import japgolly.scalajs.react.hooks.Api._ +import japgolly.scalajs.react.internal.Box +import japgolly.scalajs.react.vdom.VdomNode +import japgolly.scalajs.react.{Children, CtorType} + +trait ApiSecondaryWithRenderMacrosBinCompat[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] { + self: PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step] => + + def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = + render(step.squash(f)(_)) +} + +trait ApiSecondaryWithRenderMacros[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] + extends ApiSecondaryWithRenderMacrosBinCompat[P, C, Ctx, CtxFn, Step] { + self: PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step] => + + final override def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = + macro HookMacros.render[P, C, Ctx, CtxFn, Step] +} diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala index dbdb43386..12c708655 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala @@ -18,16 +18,6 @@ import scala.scalajs.js object HookMacros { - trait ApiSecondaryWithRenderMacros[P, C <: Children, Ctx, CtxFn[_], _Step <: SubsequentStep[Ctx, CtxFn]] { - self: PrimaryWithRender[P, C, Ctx, _Step] with Secondary[Ctx, CtxFn, _Step] => - - inline final def render(inline f: CtxFn[VdomNode])(implicit inline step: Step, inline s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = - // Without macros: render(step.squash(f)(_)) - renderWorkaround[P, C, Ctx, CtxFn, Step, s.CT](this, f, step, s) - } - - // =================================================================================================================== - private def HookMacrosImpl(qq: Quotes): HookMacrosImpl { val q: qq.type } = new HookMacrosImpl { override implicit val q: qq.type = qq diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala new file mode 100644 index 000000000..425909f0c --- /dev/null +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala @@ -0,0 +1,31 @@ +package japgolly.scalajs.react.hooks + +import japgolly.microlibs.compiletime.MacroEnv.* +import japgolly.scalajs.react.{Children, CtorType, PropsChildren, Reusability} +import japgolly.scalajs.react.component.{JsFn, ScalaFn} +import japgolly.scalajs.react.component.ScalaFn.Component +import japgolly.scalajs.react.facade +import japgolly.scalajs.react.facade.React +import japgolly.scalajs.react.hooks.Api.* +import japgolly.scalajs.react.hooks.HookCtx +import japgolly.scalajs.react.internal.{Box, MacroLogger} +import japgolly.scalajs.react.vdom.VdomNode +import scala.annotation._ +import scala.quoted.* +import scala.reflect.ClassTag +import scala.scalajs.js + +trait ApiSecondaryWithRenderMacrosBinCompat[P, C <: Children, Ctx, CtxFn[_], _Step <: SubsequentStep[Ctx, CtxFn]] { + self: PrimaryWithRender[P, C, Ctx, _Step] with Secondary[Ctx, CtxFn, _Step] => + + def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = + render(step.squash(f)(_)) +} + + trait ApiSecondaryWithRenderMacros[P, C <: Children, Ctx, CtxFn[_], _Step <: SubsequentStep[Ctx, CtxFn]] + extends ApiSecondaryWithRenderMacrosBinCompat[P, C, Ctx, CtxFn, _Step] { + self: PrimaryWithRender[P, C, Ctx, _Step] with Secondary[Ctx, CtxFn, _Step] => + + inline override final def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = + HookMacros.renderWorkaround[P, C, Ctx, CtxFn, Step, s.CT](this, f, step, s) + } diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Api.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Api.scala index 3e2eebbc8..6e1a2aa63 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Api.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Api.scala @@ -690,7 +690,7 @@ object Api { def renderWithReuseBy[A](reusableInputs: Ctx => A)(f: A => VdomNode)(implicit s: CtorType.Summoner[Box[P], C], r: Reusability[A]): Component[P, s.CT] } - trait SecondaryWithRender[P, C <: Children, Ctx, CtxFn[_], _Step <: SubsequentStep[Ctx, CtxFn]] extends PrimaryWithRender[P, C, Ctx, _Step] with Secondary[Ctx, CtxFn, _Step] with HookMacros.ApiSecondaryWithRenderMacros[P, C, Ctx, CtxFn, _Step] { + trait SecondaryWithRender[P, C <: Children, Ctx, CtxFn[_], _Step <: SubsequentStep[Ctx, CtxFn]] extends PrimaryWithRender[P, C, Ctx, _Step] with Secondary[Ctx, CtxFn, _Step] with ApiSecondaryWithRenderMacros[P, C, Ctx, CtxFn, _Step] { // This has been moved into HookMacros.ApiSecondaryWithRenderMacros // diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out3.js index 68f41c576..9950f6d98 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out3.js @@ -8,6 +8,7 @@ import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from " import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary from "./japgolly.scalajs.react.hooks.Api$Primary.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentPC$005fSubsequentSteps$0024$0024anon$002421 from "./japgolly.scalajs.react.hooks.ComponentPC_SubsequentSteps$$anon$21.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024 from "./japgolly.scalajs.react.hooks.HookComponentBuilder$.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentPC$0024FirstStep from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentPC$FirstStep.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentPC$0024Subsequent from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentPC$Subsequent.js"; @@ -20,6 +21,7 @@ import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./ import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite from "./japgolly.scalajs.react.vdom.TagLite.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagMod from "./japgolly.scalajs.react.vdom.TagMod.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode from "./japgolly.scalajs.react.vdom.VdomNode.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; @@ -27,49 +29,54 @@ import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js" import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; import * as $j_scala$002eFunction1 from "./scala.Function1.js"; import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction3 from "./scala.scalajs.runtime.AnonFunction3.js"; function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$() { - var _s = $RefreshSig$(); - this.Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$__f_Component = null; $n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$ = this; var this$4 = ($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$(), $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024.$m_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$().apply__Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$First()).withPropsChildren__Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentPC$First(); var initialState = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => 123); var step = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentPC$0024FirstStep.$c_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentPC$FirstStep(); $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentPC$0024Subsequent.$as_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentPC$Subsequent($j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useState__F0__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$4, initialState, step)); - - var rawComponent = props => { - _s(); - - var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024package$0024PropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$package$PropsChildren$().fromRawProps__sjs_js_Object__O(props); - var hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); - var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); - var p = $j_java$002elang$002eObject.$uI(props.a); - var sum = (p + $j_java$002elang$002eObject.$uI(hook1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0) + $j_java$002elang$002eObject.$uI($i_react.Children.count(children)) | 0; + var f$proxy1 = new $j_scala$002escalajs$002eruntime$002eAnonFunction3.$c_sjsr_AnonFunction3((p, c, s1) => { + var p$1 = $j_java$002elang$002eObject.$uI(p); + var s1$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(s1); + var sum = (p$1 + $j_java$002elang$002eObject.$uI(s1$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0) + $j_java$002elang$002eObject.$uI($i_react.Children.count(c)) | 0; var this$18 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); var self = "button"; - var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((hook1$2 => () => { + var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((s1$2 => () => { $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); - var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(hook1$2); + var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(s1$2); var ev$1 = $j_scala$002eFunction1.$as_F1(r.value__O()).apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$1 => { var _$1$1 = $j_java$002elang$002eObject.$uI(_$1); return 1 + _$1$1 | 0; })); return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(ev$1 === null ? null : $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$as_Ljapgolly_scalajs_react_callback_CallbackTo(ev$1).Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline); - })(hook1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(children))])); - var this$19 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$18, self, xs); - return this$19.rawElement__Ljapgolly_scalajs_react_facade_React$Element(); - }; + })(s1$1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(c))])); + return $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$18, self, xs); + }); + new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentPC$005fSubsequentSteps$0024$0024anon$002421.$c_Ljapgolly_scalajs_react_hooks_ComponentPC_SubsequentSteps$$anon$21(); + var s$proxy1 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonPC__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); + + var rawComponent = (f$proxy1$2 => { + var _s = $RefreshSig$(); + + return _s(props => { + _s(); - _s(rawComponent, "+3ihSvpsaY0Wt3tAhbVZmTm3dGg="); + var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024package$0024PropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$package$PropsChildren$().fromRawProps__sjs_js_Object__O(props); + var hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); + var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); + return $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode.$as_Ljapgolly_scalajs_react_vdom_VdomNode(f$proxy1$2.apply__O__O__O__O(props.a, children, hook1)).rawNode__O(); + }, "+3ihSvpsaY0Wt3tAhbVZmTm3dGg="); + })(f$proxy1); var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); - var this$20 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); - var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonPC__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); - this.Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$20.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); + var this$21 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + this.Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$21.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s$proxy1)); } export { $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out3.js index a24cf3919..b164064ba 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out3.js @@ -10,6 +10,7 @@ import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary from import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Secondary from "./japgolly.scalajs.react.hooks.Api$Secondary.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00241 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00243 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$3.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024 from "./japgolly.scalajs.react.hooks.HookComponentBuilder$.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024FirstStep from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentP$FirstStep.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024Subsequent from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentP$Subsequent.js"; @@ -23,6 +24,7 @@ import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./ import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite from "./japgolly.scalajs.react.vdom.TagLite.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagMod from "./japgolly.scalajs.react.vdom.TagMod.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode from "./japgolly.scalajs.react.vdom.VdomNode.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; @@ -31,10 +33,9 @@ import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; import * as $j_scala$002eFunction1 from "./scala.Function1.js"; import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; import * as $j_scala$002escalajs$002eruntime$002eAnonFunction2 from "./scala.scalajs.runtime.AnonFunction2.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction4 from "./scala.scalajs.runtime.AnonFunction4.js"; function $c_Ljapgolly_scalajs_react_test_emissions_UseState$() { - var _s = $RefreshSig$(); - this.Ljapgolly_scalajs_react_test_emissions_UseState$__f_Component = null; $n_Ljapgolly_scalajs_react_test_emissions_UseState$ = this; $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$(); @@ -59,55 +60,63 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseState$() { }); var step$2 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00242.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$2(); $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024Subsequent.$as_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$Subsequent($j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useStateBy__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$10, initialState$2, step$2)); - - var rawComponent = props => { - _s(); - - var hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); - var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); - var hook2_raw = $i_react.useState(((props$2, hook1$2) => () => { - var $$x3 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); - var p$2 = $j_java$002elang$002eObject.$uI(props$2.a); - return $$x3.apply__O__Ljapgolly_scalajs_react_internal_Box(p$2 + $j_java$002elang$002eObject.$uI(hook1$2.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0); - })(props, hook1)); - var hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); - var props$1 = props.a; - var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, hook1, hook2); - var hook3_raw = $i_react.useState((hook3_ctx$2 => () => { - var $$x6 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); - var $$x5 = $j_java$002elang$002eObject.$uI(hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props); - var this$13 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1); - var $$x4 = $j_java$002elang$002eObject.$uI(this$13.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); - var this$14 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2); - return $$x6.apply__O__Ljapgolly_scalajs_react_internal_Box(($$x5 + $$x4 | 0) + $j_java$002elang$002eObject.$uI(this$14.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0); - })(hook3_ctx)); - var hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); - $j_java$002elang$002eObject.$uI(props.a); - var sum = ($j_java$002elang$002eObject.$uI(hook1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) + $j_java$002elang$002eObject.$uI(hook2.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0) + $j_java$002elang$002eObject.$uI(hook3.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0; - var this$23 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + var f$proxy1 = new $j_scala$002escalajs$002eruntime$002eAnonFunction4.$c_sjsr_AnonFunction4((_$1, s1$2, s2, s3) => { + $j_java$002elang$002eObject.$uI(_$1); + var s1$3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(s1$2); + var s2$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(s2); + var s3$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(s3); + var sum = ($j_java$002elang$002eObject.$uI(s1$3.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) + $j_java$002elang$002eObject.$uI(s2$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0) + $j_java$002elang$002eObject.$uI(s3$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0; + var this$20 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); var self = "button"; - var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((hook1$3 => () => { + var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((s1$2$1 => () => { $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); - var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(hook1$3); + var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(s1$2$1); var ev$1 = $j_scala$002eFunction1.$as_F1(r.value__O()).apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$2 => { var _$2$1 = $j_java$002elang$002eObject.$uI(_$2); return 1 + _$2$1 | 0; })); return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(ev$1 === null ? null : $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$as_Ljapgolly_scalajs_react_callback_CallbackTo(ev$1).Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline); - })(hook1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)])); - var this$24 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$23, self, xs); - return this$24.rawElement__Ljapgolly_scalajs_react_facade_React$Element(); - }; + })(s1$3)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)])); + return $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$20, self, xs); + }); + new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00243.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$3(); + var s$proxy1 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); + + var rawComponent = (f$proxy1$2 => { + var _s = $RefreshSig$(); + + return _s(props => { + _s(); - _s(rawComponent, "ua6eMzabMXKN9f38Hp0jS9R7o6c="); + var hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); + var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); + var hook2_raw = $i_react.useState(((props$2, hook1$2) => () => { + var $$x3 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); + var p$2 = $j_java$002elang$002eObject.$uI(props$2.a); + return $$x3.apply__O__Ljapgolly_scalajs_react_internal_Box(p$2 + $j_java$002elang$002eObject.$uI(hook1$2.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0); + })(props, hook1)); + var hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); + var props$1 = props.a; + var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, hook1, hook2); + var hook3_raw = $i_react.useState((hook3_ctx$2 => () => { + var $$x6 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); + var $$x5 = $j_java$002elang$002eObject.$uI(hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props); + var this$24 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1); + var $$x4 = $j_java$002elang$002eObject.$uI(this$24.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); + var this$25 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2); + return $$x6.apply__O__Ljapgolly_scalajs_react_internal_Box(($$x5 + $$x4 | 0) + $j_java$002elang$002eObject.$uI(this$25.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0); + })(hook3_ctx)); + var hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); + return $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode.$as_Ljapgolly_scalajs_react_vdom_VdomNode(f$proxy1$2.apply__O__O__O__O__O(props.a, hook1, hook2, hook3)).rawNode__O(); + }, "Ptw8FsFRbJj0NQATrtyH6HlQ7h4="); + })(f$proxy1); var $$x7 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); - var this$25 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); - var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); - this.Ljapgolly_scalajs_react_test_emissions_UseState$__f_Component = $$x7.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$25.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); + var this$26 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + this.Ljapgolly_scalajs_react_test_emissions_UseState$__f_Component = $$x7.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$26.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s$proxy1)); } export { $c_Ljapgolly_scalajs_react_test_emissions_UseState$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out3.js index 9e382ba6f..87daa8b52 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out3.js @@ -8,6 +8,7 @@ import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 fro import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary from "./japgolly.scalajs.react.hooks.Api$Primary.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00241 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00243 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$3.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024 from "./japgolly.scalajs.react.hooks.HookComponentBuilder$.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024FirstStep from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentP$FirstStep.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024Subsequent from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentP$Subsequent.js"; @@ -23,6 +24,7 @@ import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./ import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite from "./japgolly.scalajs.react.vdom.TagLite.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagMod from "./japgolly.scalajs.react.vdom.TagMod.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode from "./japgolly.scalajs.react.vdom.VdomNode.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; @@ -31,10 +33,9 @@ import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; import * as $j_scala$002eFunction1 from "./scala.Function1.js"; import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; import * as $j_scala$002escalajs$002eruntime$002eAnonFunction2 from "./scala.scalajs.runtime.AnonFunction2.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction4 from "./scala.scalajs.runtime.AnonFunction4.js"; function $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$() { - var _s = $RefreshSig$(); - this.Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$__f_Component = null; $n_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$ = this; $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$(); @@ -75,76 +76,84 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$() { var evidence$5 = this$29.by_$eq$eq__F2(); var step$3 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00242.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$2(); $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024Subsequent.$as_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$Subsequent(this$31.next__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((initialState$2$4, evidence$4$2$2, evidence$5$2$2) => ctx$3 => $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuse$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuse$().unsafeCreate__F0__F2__s_reflect_ClassTag__Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((initialState$8$2$2, ctx$2$2) => () => initialState$8$2$2.apply__O__O(ctx$2$2))(initialState$2$4, ctx$3)), evidence$5$2$2, evidence$4$2$2))(initialState$5, evidence$4, evidence$5)), step$3)); - - var rawComponent = props => { - _s(); - - var hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); - var this$35 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); - var r = this$35.by_$eq$eq__F2(); - var ct = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); - var rr = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r); - var this$40 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); - var us = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$40, r); - var hook1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us, rr, ct); - var hook2_raw = $i_react.useState(((props$2, hook1$2) => () => { - var $$x3 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); - var p$2 = $j_java$002elang$002eObject.$uI(props$2.a); - var this$42 = hook1$2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - return $$x3.apply__O__Ljapgolly_scalajs_react_internal_Box(p$2 + $j_java$002elang$002eObject.$uI(this$42.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0); - })(props, hook1)); - var this$43 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); - var r$1 = this$43.by_$eq$eq__F2(); - var ct$1 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); - var rr$1 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r$1); - var this$48 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); - var us$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$48, r$1); - var hook2 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us$1, rr$1, ct$1); - var props$1 = props.a; - var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, hook1, hook2); - var hook3_raw = $i_react.useState((hook3_ctx$2 => () => { - var $$x6 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); - var $$x5 = $j_java$002elang$002eObject.$uI(hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props); - var this$51 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1); - var this$52 = this$51.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - var $$x4 = $j_java$002elang$002eObject.$uI(this$52.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); - var this$53 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2); - var this$54 = this$53.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - return $$x6.apply__O__Ljapgolly_scalajs_react_internal_Box(($$x5 + $$x4 | 0) + $j_java$002elang$002eObject.$uI(this$54.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0); - })(hook3_ctx)); - var this$55 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); - var r$2 = this$55.by_$eq$eq__F2(); - var ct$2 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); - var rr$2 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r$2); - var this$60 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); - var us$2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$60, r$2); - var hook3 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us$2, rr$2, ct$2); - $j_java$002elang$002eObject.$uI(props.a); - var this$62 = hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - var $$x8 = $j_java$002elang$002eObject.$uI(this$62.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); - var this$63 = hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - var $$x7 = $j_java$002elang$002eObject.$uI(this$63.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); - var this$64 = hook3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - var sum = ($$x8 + $$x7 | 0) + $j_java$002elang$002eObject.$uI(this$64.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0; - var this$72 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + var f$proxy1 = new $j_scala$002escalajs$002eruntime$002eAnonFunction4.$c_sjsr_AnonFunction4((_$1, s1$2, s2, s3) => { + $j_java$002elang$002eObject.$uI(_$1); + var s1$3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(s1$2); + var s2$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(s2); + var s3$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(s3); + var this$34 = s1$3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var $$x4 = $j_java$002elang$002eObject.$uI(this$34.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); + var this$35 = s2$1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var $$x3 = $j_java$002elang$002eObject.$uI(this$35.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); + var this$36 = s3$1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var sum = ($$x4 + $$x3 | 0) + $j_java$002elang$002eObject.$uI(this$36.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0; + var this$45 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); var self = "button"; - var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("DEBUG = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((hook1$3 => () => hook1$3.modState__F1__Ljapgolly_scalajs_react_Reusable(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$2 => { + var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("DEBUG = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((s1$2$1 => () => s1$2$1.modState__F1__Ljapgolly_scalajs_react_Reusable(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$2 => { var _$2$1 = $j_java$002elang$002eObject.$uI(_$2); return 1 + _$2$1 | 0; - })))(hook1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().reusableDefaultSync__F1())])); - var this$73 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$72, self, xs); - return this$73.rawElement__Ljapgolly_scalajs_react_facade_React$Element(); - }; + })))(s1$3)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().reusableDefaultSync__F1())])); + return $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$45, self, xs); + }); + new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00243.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$3(); + var s$proxy1 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); + + var rawComponent = (f$proxy1$2 => { + var _s = $RefreshSig$(); + + return _s(props => { + _s(); - _s(rawComponent, "IWUf6wx8RInLzShmnpth33nvXy0="); + var hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); + var this$48 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var r = this$48.by_$eq$eq__F2(); + var ct = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var rr = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r); + var this$53 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); + var us = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$53, r); + var hook1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us, rr, ct); + var hook2_raw = $i_react.useState(((props$2, hook1$2) => () => { + var $$x5 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); + var p$2 = $j_java$002elang$002eObject.$uI(props$2.a); + var this$55 = hook1$2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + return $$x5.apply__O__Ljapgolly_scalajs_react_internal_Box(p$2 + $j_java$002elang$002eObject.$uI(this$55.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0); + })(props, hook1)); + var this$56 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var r$1 = this$56.by_$eq$eq__F2(); + var ct$1 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var rr$1 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r$1); + var this$61 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); + var us$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$61, r$1); + var hook2 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us$1, rr$1, ct$1); + var props$1 = props.a; + var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, hook1, hook2); + var hook3_raw = $i_react.useState((hook3_ctx$2 => () => { + var $$x8 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); + var $$x7 = $j_java$002elang$002eObject.$uI(hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props); + var this$64 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1); + var this$65 = this$64.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var $$x6 = $j_java$002elang$002eObject.$uI(this$65.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); + var this$66 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2); + var this$67 = this$66.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + return $$x8.apply__O__Ljapgolly_scalajs_react_internal_Box(($$x7 + $$x6 | 0) + $j_java$002elang$002eObject.$uI(this$67.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0); + })(hook3_ctx)); + var this$68 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var r$2 = this$68.by_$eq$eq__F2(); + var ct$2 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var rr$2 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r$2); + var this$73 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); + var us$2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$73, r$2); + var hook3 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us$2, rr$2, ct$2); + return $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode.$as_Ljapgolly_scalajs_react_vdom_VdomNode(f$proxy1$2.apply__O__O__O__O__O(props.a, hook1, hook2, hook3)).rawNode__O(); + }, "2BAfwknz55uf3wBgBMOZEfZt5Gk="); + })(f$proxy1); var $$x9 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); - var this$74 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); - var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); - this.Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$__f_Component = $$x9.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$74.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); + var this$75 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + this.Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$__f_Component = $$x9.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$75.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s$proxy1)); } export { $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$ }; From 76790d5254382d63cd90a7c26ab5423d0c4fc52d Mon Sep 17 00:00:00 2001 From: David Barri Date: Fri, 10 Jun 2022 15:06:43 +1000 Subject: [PATCH 30/72] Generate test emissions with less SJS safety --- library/project/Build.scala | 12 ++-- .../rr-sjr/HooksWithChildren-out2.js | 16 +++--- .../rr-sjr/HooksWithChildren-out3.js | 16 +++--- .../test/resources/rr-sjr/UseState-out2.js | 24 ++++---- .../test/resources/rr-sjr/UseState-out3.js | 57 +++++++++---------- .../rr-sjr/UseStateWithReuse-out2.js | 22 +++---- .../rr-sjr/UseStateWithReuse-out3.js | 57 +++++++++---------- 7 files changed, 101 insertions(+), 103 deletions(-) diff --git a/library/project/Build.scala b/library/project/Build.scala index 572aa52c9..25d9d373f 100644 --- a/library/project/Build.scala +++ b/library/project/Build.scala @@ -1,7 +1,7 @@ import sbt._ import sbt.Keys._ import org.scalajs.jsdependencies.sbtplugin.JSDependenciesPlugin.autoImport._ -import org.scalajs.linker.interface.{ModuleInitializer, ModuleSplitStyle} +import org.scalajs.linker.interface.{CheckedBehavior, ModuleInitializer, ModuleSplitStyle} import org.scalajs.sbtplugin.ScalaJSPlugin import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._ import scalafix.sbt.BuildInfo.{scalafixVersion => ScalafixVer} @@ -250,11 +250,11 @@ object ScalaJsReact { .withModuleSplitStyle(ModuleSplitStyle.SmallestModules) .withSourceMap(false) // .withESFeatures(_.withESVersion(ESVersion.ES2021)) - // .withSemantics(_ - // .withArrayIndexOutOfBounds(CheckedBehavior.Unchecked) - // .withAsInstanceOfs(CheckedBehavior.Unchecked) - // .withProductionMode(true) - // ) + .withSemantics(_ + .withArrayIndexOutOfBounds(CheckedBehavior.Unchecked) + .withAsInstanceOfs(CheckedBehavior.Unchecked) + .withProductionMode(true) + ) }, Compile / scalaJSModuleInitializers += ModuleInitializer.mainMethod("japgolly.scalajs.react.test.emissions.Main", "main") diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out2.js index 0b18166aa..017d6a17f 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out2.js @@ -4,8 +4,8 @@ var _s = $RefreshSig$(); import * as $i_react from "react"; import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ePropsChildren from "./japgolly.scalajs.react.PropsChildren.js"; -import * as $j_japgolly$002escalajs$002ereact$002eReusable$0024 from "./japgolly.scalajs.react.Reusable$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024 from "./japgolly.scalajs.react.PropsChildren$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusability from "./japgolly.scalajs.react.Reusability.js"; import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; @@ -48,23 +48,23 @@ $h_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$.prototype = $c_Ljap $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$.prototype.japgolly$scalajs$react$test$emissions$HooksWithChildren$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s(function (props) { _s(); - var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren.$m_Ljapgolly_scalajs_react_PropsChildren$().fromRawProps__sjs_js_Object__sjs_js_Any(props); + var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$().fromRawProps__sjs_js_Object__sjs_js_Any(props); var hook1_raw = $i_react.useState(() => { $m_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$(); return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123); }); var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); - var sum = ($j_java$002elang$002eObject.$uI(props.a) + $j_java$002elang$002eObject.$uI(hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]) | 0) + $j_japgolly$002escalajs$002ereact$002ePropsChildren.$m_Ljapgolly_scalajs_react_PropsChildren$().count$extension__sjs_js_Any__I(children) | 0; + var sum = ((props.a | 0) + (hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$().count$extension__sjs_js_Any__I(children) | 0; var $$x1 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((hook1$1 => () => { - $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(hook1$1); - return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$as_Ljapgolly_scalajs_react_callback_CallbackTo($j_scala$002eFunction1.$as_F1(r.value__O()).apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$1$2 => { - var x$1 = $j_java$002elang$002eObject.$uI(x$1$2); + return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$1$2 => { + var x$1 = x$1$2 | 0; return 1 + x$1 | 0; - }))).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline); + })).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline); })(hook1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(children))]; var this$17 = $$x1.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("button", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); return $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement.$f_Ljapgolly_scalajs_react_vdom_VdomElement__rawNode__sjs_js_$bar(this$17); diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out3.js index 9950f6d98..08821c484 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out3.js @@ -37,11 +37,11 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$() { var this$4 = ($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$(), $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024.$m_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$().apply__Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$First()).withPropsChildren__Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentPC$First(); var initialState = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => 123); var step = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentPC$0024FirstStep.$c_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentPC$FirstStep(); - $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentPC$0024Subsequent.$as_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentPC$Subsequent($j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useState__F0__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$4, initialState, step)); + $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useState__F0__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$4, initialState, step); var f$proxy1 = new $j_scala$002escalajs$002eruntime$002eAnonFunction3.$c_sjsr_AnonFunction3((p, c, s1) => { - var p$1 = $j_java$002elang$002eObject.$uI(p); - var s1$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(s1); - var sum = (p$1 + $j_java$002elang$002eObject.$uI(s1$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0) + $j_java$002elang$002eObject.$uI($i_react.Children.count(c)) | 0; + var p$1 = p | 0; + var s1$1 = s1; + var sum = (p$1 + (s1$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + ($i_react.Children.count(c) | 0) | 0; var this$18 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); @@ -49,12 +49,12 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$() { var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((s1$2 => () => { $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(s1$2); - var ev$1 = $j_scala$002eFunction1.$as_F1(r.value__O()).apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$1 => { - var _$1$1 = $j_java$002elang$002eObject.$uI(_$1); + var ev$1 = r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$1 => { + var _$1$1 = _$1 | 0; return 1 + _$1$1 | 0; })); - return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(ev$1 === null ? null : $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$as_Ljapgolly_scalajs_react_callback_CallbackTo(ev$1).Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline); + return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(ev$1 === null ? null : ev$1.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline); })(s1$1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(c))])); return $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$18, self, xs); }); @@ -70,7 +70,7 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$() { var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024package$0024PropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$package$PropsChildren$().fromRawProps__sjs_js_Object__O(props); var hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); - return $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode.$as_Ljapgolly_scalajs_react_vdom_VdomNode(f$proxy1$2.apply__O__O__O__O(props.a, children, hook1)).rawNode__O(); + return f$proxy1$2.apply__O__O__O__O(props.a, children, hook1).rawNode__O(); }, "+3ihSvpsaY0Wt3tAhbVZmTm3dGg="); })(f$proxy1); diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out2.js index ace1c539c..7161c0fd1 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out2.js @@ -4,7 +4,7 @@ var _s = $RefreshSig$(); import * as $i_react from "react"; import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; -import * as $j_japgolly$002escalajs$002ereact$002eReusable$0024 from "./japgolly.scalajs.react.Reusable$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusability from "./japgolly.scalajs.react.Reusability.js"; import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; @@ -47,16 +47,16 @@ export { $h_Ljapgolly_scalajs_react_test_emissions_UseState$ }; $h_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype; $c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype.japgolly$scalajs$react$test$emissions$UseState$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box = function (props$1, hook1$1) { - return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_java$002elang$002eObject.$uI(props$1.a) + $j_java$002elang$002eObject.$uI(hook1$1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]) | 0); + return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box((props$1.a | 0) + (hook1$1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0); }; $c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype.japgolly$scalajs$react$test$emissions$UseState$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box = function (hook3_ctx$1) { var $$x3 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); - var $$x2 = $j_java$002elang$002eObject.$uI(hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props); - var this$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1); - var $$x1 = $j_java$002elang$002eObject.$uI(this$1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]); - var this$2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2); - return $$x3.apply__O__Ljapgolly_scalajs_react_internal_Box(($$x2 + $$x1 | 0) + $j_java$002elang$002eObject.$uI(this$2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]) | 0); + var $$x2 = hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + var this$1 = hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; + var $$x1 = this$1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]; + var this$2 = hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; + return $$x3.apply__O__Ljapgolly_scalajs_react_internal_Box((($$x2 | 0) + ($$x1 | 0) | 0) + (this$2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0); }; $c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype.japgolly$scalajs$react$test$emissions$UseState$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s(function (props) { @@ -73,17 +73,17 @@ $c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype.japgolly$scalajs$r var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$2, hook1, hook2); var hook3_raw = $i_react.useState((hook3_ctx$1 => () => $m_Ljapgolly_scalajs_react_test_emissions_UseState$().japgolly$scalajs$react$test$emissions$UseState$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box(hook3_ctx$1))(hook3_ctx)); var hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); - var sum = ($j_java$002elang$002eObject.$uI(hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]) + $j_java$002elang$002eObject.$uI(hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]) | 0) + $j_java$002elang$002eObject.$uI(hook3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]) | 0; + var sum = ((hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) + (hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (hook3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0; var $$x1 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((hook1$2 => () => { - $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(hook1$2); - return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$as_Ljapgolly_scalajs_react_callback_CallbackTo($j_scala$002eFunction1.$as_F1(r.value__O()).apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$2$2 => { - var x$2 = $j_java$002elang$002eObject.$uI(x$2$2); + return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$2$2 => { + var x$2 = x$2$2 | 0; return 1 + x$2 | 0; - }))).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline); + })).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline); })(hook1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]; var this$15 = $$x1.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("button", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); return $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement.$f_Ljapgolly_scalajs_react_vdom_VdomElement__rawNode__sjs_js_$bar(this$15); diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out3.js index b164064ba..5ed2ae950 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out3.js @@ -42,30 +42,29 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseState$() { var this$4 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024.$m_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$().apply__Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$First(); var initialState = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => 123); var step = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024FirstStep.$c_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$FirstStep(); - var this$6 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Secondary.$as_Ljapgolly_scalajs_react_hooks_Api$Secondary($j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useState__F0__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$4, initialState, step)); + var this$6 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useState__F0__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$4, initialState, step); var initialState$1 = new $j_scala$002escalajs$002eruntime$002eAnonFunction2.$c_sjsr_AnonFunction2((p, s1) => { - var p$1 = $j_java$002elang$002eObject.$uI(p); - var s1$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(s1); - return p$1 + $j_java$002elang$002eObject.$uI(s1$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0; + var p$1 = p | 0; + var s1$1 = s1; + return p$1 + (s1$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; }); var step$1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$1(); - var this$10 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$as_Ljapgolly_scalajs_react_hooks_Api$Primary($j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Secondary.$f_Ljapgolly_scalajs_react_hooks_Api$Secondary__useStateBy__O__Ljapgolly_scalajs_react_hooks_Api$SubsequentStep__O(this$6, initialState$1, step$1)); + var this$10 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Secondary.$f_Ljapgolly_scalajs_react_hooks_Api$Secondary__useStateBy__O__Ljapgolly_scalajs_react_hooks_Api$SubsequentStep__O(this$6, initialState$1, step$1); var initialState$2 = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(δ => { - var δ$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$as_Ljapgolly_scalajs_react_hooks_HookCtx$P2(δ); - var $$x2 = $j_java$002elang$002eObject.$uI(δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props); - var this$7 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1); - var $$x1 = $j_java$002elang$002eObject.$uI(this$7.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); - var this$8 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2); - return ($$x2 + $$x1 | 0) + $j_java$002elang$002eObject.$uI(this$8.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0; + var δ$1 = δ; + var $$x2 = δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + var this$7 = δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; + var $$x1 = this$7.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; + var this$8 = δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; + return (($$x2 | 0) + ($$x1 | 0) | 0) + (this$8.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; }); var step$2 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00242.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$2(); - $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024Subsequent.$as_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$Subsequent($j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useStateBy__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$10, initialState$2, step$2)); + $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useStateBy__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$10, initialState$2, step$2); var f$proxy1 = new $j_scala$002escalajs$002eruntime$002eAnonFunction4.$c_sjsr_AnonFunction4((_$1, s1$2, s2, s3) => { - $j_java$002elang$002eObject.$uI(_$1); - var s1$3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(s1$2); - var s2$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(s2); - var s3$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(s3); - var sum = ($j_java$002elang$002eObject.$uI(s1$3.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) + $j_java$002elang$002eObject.$uI(s2$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0) + $j_java$002elang$002eObject.$uI(s3$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0; + var s1$3 = s1$2; + var s2$1 = s2; + var s3$1 = s3; + var sum = ((s1$3.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) + (s2$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (s3$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; var this$20 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); @@ -73,12 +72,12 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseState$() { var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((s1$2$1 => () => { $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(s1$2$1); - var ev$1 = $j_scala$002eFunction1.$as_F1(r.value__O()).apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$2 => { - var _$2$1 = $j_java$002elang$002eObject.$uI(_$2); + var ev$1 = r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$2 => { + var _$2$1 = _$2 | 0; return 1 + _$2$1 | 0; })); - return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(ev$1 === null ? null : $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$as_Ljapgolly_scalajs_react_callback_CallbackTo(ev$1).Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline); + return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(ev$1 === null ? null : ev$1.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline); })(s1$3)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)])); return $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$20, self, xs); }); @@ -95,23 +94,23 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseState$() { var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); var hook2_raw = $i_react.useState(((props$2, hook1$2) => () => { var $$x3 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); - var p$2 = $j_java$002elang$002eObject.$uI(props$2.a); - return $$x3.apply__O__Ljapgolly_scalajs_react_internal_Box(p$2 + $j_java$002elang$002eObject.$uI(hook1$2.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0); + var p$2 = props$2.a | 0; + return $$x3.apply__O__Ljapgolly_scalajs_react_internal_Box(p$2 + (hook1$2.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0); })(props, hook1)); var hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); var props$1 = props.a; var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, hook1, hook2); var hook3_raw = $i_react.useState((hook3_ctx$2 => () => { var $$x6 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); - var $$x5 = $j_java$002elang$002eObject.$uI(hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props); - var this$24 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1); - var $$x4 = $j_java$002elang$002eObject.$uI(this$24.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); - var this$25 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2); - return $$x6.apply__O__Ljapgolly_scalajs_react_internal_Box(($$x5 + $$x4 | 0) + $j_java$002elang$002eObject.$uI(this$25.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0); + var $$x5 = hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + var this$24 = hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; + var $$x4 = this$24.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; + var this$25 = hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; + return $$x6.apply__O__Ljapgolly_scalajs_react_internal_Box((($$x5 | 0) + ($$x4 | 0) | 0) + (this$25.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0); })(hook3_ctx)); var hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); - return $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode.$as_Ljapgolly_scalajs_react_vdom_VdomNode(f$proxy1$2.apply__O__O__O__O__O(props.a, hook1, hook2, hook3)).rawNode__O(); - }, "Ptw8FsFRbJj0NQATrtyH6HlQ7h4="); + return f$proxy1$2.apply__O__O__O__O__O(props.a, hook1, hook2, hook3).rawNode__O(); + }, "jQdGBdZMpVSjxy9qYSNUEqi9mK0="); })(f$proxy1); var $$x7 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out2.js index a9ee064b5..dd455f4df 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out2.js @@ -49,20 +49,20 @@ $h_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$.prototype = $c_Ljap $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$.prototype.japgolly$scalajs$react$test$emissions$UseStateWithReuse$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__Ljapgolly_scalajs_react_internal_Box = function (props$1, hook1$1) { var $$x2 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); - var $$x1 = $j_java$002elang$002eObject.$uI(props$1.a); + var $$x1 = props$1.a; var this$1 = hook1$1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - return $$x2.apply__O__Ljapgolly_scalajs_react_internal_Box($$x1 + $j_java$002elang$002eObject.$uI(this$1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]) | 0); + return $$x2.apply__O__Ljapgolly_scalajs_react_internal_Box(($$x1 | 0) + (this$1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0); }; $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$.prototype.japgolly$scalajs$react$test$emissions$UseStateWithReuse$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box = function (hook3_ctx$1) { var $$x3 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); - var $$x2 = $j_java$002elang$002eObject.$uI(hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props); - var this$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1); + var $$x2 = hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + var this$1 = hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; var this$2 = this$1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - var $$x1 = $j_java$002elang$002eObject.$uI(this$2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]); - var this$3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2); + var $$x1 = this$2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]; + var this$3 = hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; var this$4 = this$3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - return $$x3.apply__O__Ljapgolly_scalajs_react_internal_Box(($$x2 + $$x1 | 0) + $j_java$002elang$002eObject.$uI(this$4.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]) | 0); + return $$x3.apply__O__Ljapgolly_scalajs_react_internal_Box((($$x2 | 0) + ($$x1 | 0) | 0) + (this$4.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0); }; $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$.prototype.japgolly$scalajs$react$test$emissions$UseStateWithReuse$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s(function (props) { @@ -98,16 +98,16 @@ $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$.prototype.japgolly$ var us$2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$17, r$2); var hook3 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us$2, rr$2, ct$2); var this$18 = hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - var $$x2 = $j_java$002elang$002eObject.$uI(this$18.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]); + var $$x2 = this$18.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]; var this$19 = hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - var $$x1 = $j_java$002elang$002eObject.$uI(this$19.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]); + var $$x1 = this$19.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]; var this$20 = hook3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - var sum = ($$x2 + $$x1 | 0) + $j_java$002elang$002eObject.$uI(this$20.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]) | 0; + var sum = (($$x2 | 0) + ($$x1 | 0) | 0) + (this$20.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0; var $$x3 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("DEBUG = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((hook1$2 => () => hook1$2.modState__F1__Ljapgolly_scalajs_react_Reusable(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$2$2 => { - var x$2 = $j_java$002elang$002eObject.$uI(x$2$2); + var x$2 = x$2$2 | 0; return 1 + x$2 | 0; })))(hook1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().reusableDefaultSync__F1())]; var this$32 = $$x3.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("button", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out3.js index 87daa8b52..d3205ac06 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out3.js @@ -49,50 +49,49 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$() { var f = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((initialState$2$1, evidence$4$2, evidence$5$2) => ctx => $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuse$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuse$().unsafeCreate__F0__F2__s_reflect_ClassTag__Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((initialState$8$2, ctx$2) => () => initialState$8$2.apply__O__O(ctx$2))(initialState$2$1, ctx)), evidence$5$2, evidence$4$2))(initialState$1, evidence$2, evidence$3)); var this$18 = this$8.next__F1__Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$FirstStep__Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$Subsequent(f, step); var initialState$3 = new $j_scala$002escalajs$002eruntime$002eAnonFunction2.$c_sjsr_AnonFunction2((p, s1) => { - var p$1 = $j_java$002elang$002eObject.$uI(p); - var s1$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(s1); + var p$1 = p | 0; + var s1$1 = s1; var this$12 = s1$1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - return p$1 + $j_java$002elang$002eObject.$uI(this$12.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0; + return p$1 + (this$12.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; }); var evidence$6 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); var this$16 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); var evidence$7 = this$16.by_$eq$eq__F2(); var step$1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$1(); - var initialState$4 = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((initialState$2$2, step$2) => _$62 => $j_scala$002eFunction1.$as_F1(step$2.squash__F1().apply__O__O(initialState$2$2)).apply__O__O(_$62))(initialState$3, step$1)); + var initialState$4 = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((initialState$2$2, step$2) => _$62 => step$2.squash__F1().apply__O__O(initialState$2$2).apply__O__O(_$62))(initialState$3, step$1)); var f$1 = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((initialState$2$3, evidence$4$2$1, evidence$5$2$1) => ctx$1 => $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuse$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuse$().unsafeCreate__F0__F2__s_reflect_ClassTag__Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((initialState$8$2$1, ctx$2$1) => () => initialState$8$2$1.apply__O__O(ctx$2$1))(initialState$2$3, ctx$1)), evidence$5$2$1, evidence$4$2$1))(initialState$4, evidence$6, evidence$7)); - var this$31 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$as_Ljapgolly_scalajs_react_hooks_Api$Primary(this$18.next__F1__Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$SubsequentStep__O(f$1, step$1)); + var this$31 = this$18.next__F1__Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$SubsequentStep__O(f$1, step$1); var initialState$5 = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(δ => { - var δ$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$as_Ljapgolly_scalajs_react_hooks_HookCtx$P2(δ); - var $$x2 = $j_java$002elang$002eObject.$uI(δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props); - var this$22 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1); + var δ$1 = δ; + var $$x2 = δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + var this$22 = δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; var this$23 = this$22.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - var $$x1 = $j_java$002elang$002eObject.$uI(this$23.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); - var this$24 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2); + var $$x1 = this$23.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; + var this$24 = δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; var this$25 = this$24.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - return ($$x2 + $$x1 | 0) + $j_java$002elang$002eObject.$uI(this$25.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0; + return (($$x2 | 0) + ($$x1 | 0) | 0) + (this$25.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; }); var evidence$4 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); var this$29 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); var evidence$5 = this$29.by_$eq$eq__F2(); var step$3 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00242.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$2(); - $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024Subsequent.$as_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$Subsequent(this$31.next__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((initialState$2$4, evidence$4$2$2, evidence$5$2$2) => ctx$3 => $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuse$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuse$().unsafeCreate__F0__F2__s_reflect_ClassTag__Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((initialState$8$2$2, ctx$2$2) => () => initialState$8$2$2.apply__O__O(ctx$2$2))(initialState$2$4, ctx$3)), evidence$5$2$2, evidence$4$2$2))(initialState$5, evidence$4, evidence$5)), step$3)); + this$31.next__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((initialState$2$4, evidence$4$2$2, evidence$5$2$2) => ctx$3 => $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuse$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuse$().unsafeCreate__F0__F2__s_reflect_ClassTag__Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((initialState$8$2$2, ctx$2$2) => () => initialState$8$2$2.apply__O__O(ctx$2$2))(initialState$2$4, ctx$3)), evidence$5$2$2, evidence$4$2$2))(initialState$5, evidence$4, evidence$5)), step$3); var f$proxy1 = new $j_scala$002escalajs$002eruntime$002eAnonFunction4.$c_sjsr_AnonFunction4((_$1, s1$2, s2, s3) => { - $j_java$002elang$002eObject.$uI(_$1); - var s1$3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(s1$2); - var s2$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(s2); - var s3$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(s3); + var s1$3 = s1$2; + var s2$1 = s2; + var s3$1 = s3; var this$34 = s1$3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - var $$x4 = $j_java$002elang$002eObject.$uI(this$34.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); + var $$x4 = this$34.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; var this$35 = s2$1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - var $$x3 = $j_java$002elang$002eObject.$uI(this$35.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); + var $$x3 = this$35.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; var this$36 = s3$1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - var sum = ($$x4 + $$x3 | 0) + $j_java$002elang$002eObject.$uI(this$36.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0; + var sum = (($$x4 | 0) + ($$x3 | 0) | 0) + (this$36.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; var this$45 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); var self = "button"; var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("DEBUG = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((s1$2$1 => () => s1$2$1.modState__F1__Ljapgolly_scalajs_react_Reusable(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$2 => { - var _$2$1 = $j_java$002elang$002eObject.$uI(_$2); + var _$2$1 = _$2 | 0; return 1 + _$2$1 | 0; })))(s1$3)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().reusableDefaultSync__F1())])); @@ -117,9 +116,9 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$() { var hook1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us, rr, ct); var hook2_raw = $i_react.useState(((props$2, hook1$2) => () => { var $$x5 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); - var p$2 = $j_java$002elang$002eObject.$uI(props$2.a); + var p$2 = props$2.a | 0; var this$55 = hook1$2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - return $$x5.apply__O__Ljapgolly_scalajs_react_internal_Box(p$2 + $j_java$002elang$002eObject.$uI(this$55.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0); + return $$x5.apply__O__Ljapgolly_scalajs_react_internal_Box(p$2 + (this$55.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0); })(props, hook1)); var this$56 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); var r$1 = this$56.by_$eq$eq__F2(); @@ -132,13 +131,13 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$() { var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, hook1, hook2); var hook3_raw = $i_react.useState((hook3_ctx$2 => () => { var $$x8 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); - var $$x7 = $j_java$002elang$002eObject.$uI(hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props); - var this$64 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1); + var $$x7 = hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + var this$64 = hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; var this$65 = this$64.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - var $$x6 = $j_java$002elang$002eObject.$uI(this$65.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); - var this$66 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$as_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2); + var $$x6 = this$65.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; + var this$66 = hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; var this$67 = this$66.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - return $$x8.apply__O__Ljapgolly_scalajs_react_internal_Box(($$x7 + $$x6 | 0) + $j_java$002elang$002eObject.$uI(this$67.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]) | 0); + return $$x8.apply__O__Ljapgolly_scalajs_react_internal_Box((($$x7 | 0) + ($$x6 | 0) | 0) + (this$67.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0); })(hook3_ctx)); var this$68 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); var r$2 = this$68.by_$eq$eq__F2(); @@ -147,8 +146,8 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$() { var this$73 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); var us$2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$73, r$2); var hook3 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us$2, rr$2, ct$2); - return $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode.$as_Ljapgolly_scalajs_react_vdom_VdomNode(f$proxy1$2.apply__O__O__O__O__O(props.a, hook1, hook2, hook3)).rawNode__O(); - }, "2BAfwknz55uf3wBgBMOZEfZt5Gk="); + return f$proxy1$2.apply__O__O__O__O__O(props.a, hook1, hook2, hook3).rawNode__O(); + }, "rdPtgGYg2x5mCMwXQexQFncti08="); })(f$proxy1); var $$x9 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); From 48f92cf4e0369265b8dba8e10ee6cd120e7eaa61 Mon Sep 17 00:00:00 2001 From: David Barri Date: Fri, 10 Jun 2022 15:32:58 +1000 Subject: [PATCH 31/72] Make emission testing output more useful for debugging --- .../react/test/emissions/EmissionTest.scala | 4 +- .../test/emissions/ReactRefreshTest.scala | 2 +- .../react/test/emissions/util/Babel.scala | 11 +- .../emissions/util/MutableVirtualFile.scala | 29 ++++- .../react/test/emissions/util/TestJs.scala | 39 +++++-- .../react/test/emissions/util/Util.scala | 100 +++++++++++++++++- 6 files changed, 169 insertions(+), 16 deletions(-) diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/EmissionTest.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/EmissionTest.scala index 864a6dc92..b7355a189 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/EmissionTest.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/EmissionTest.scala @@ -62,8 +62,8 @@ object EmissionTest extends TestSuite { Util.readOrCreateFile(expectFilename, actual) match { case None => utestOutput = s"Created $expectFilename" case Some(e) => - val actual2 = onCmp.runAnon(actual).content - val expect2 = onCmp.runAnon(e).content + val actual2 = onCmp.runAs(name, actual).content + val expect2 = onCmp.runAs(name, e).content assertMultiline(actual2, expect2) } diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala index 0d507d0bb..2884a1901 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala @@ -139,7 +139,7 @@ object ReactRefreshTest extends TestSuite { } } finally { - def show(s: String): String = onShow.runAnon(s).content + def show(s: String): String = onShow.runAs(name, s).content lazy val before = show(babel.before) lazy val after = show(babel.after) if (showPreBabel) diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Babel.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Babel.scala index d32025f72..b0d48d672 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Babel.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Babel.scala @@ -22,8 +22,10 @@ final case class Babel(before : String, } } - def assertOutput(is: String)(implicit l: Line): Unit = - assertMultiline(actual = after, expect = is) + def assertOutput(expect: String)(implicit l: Line): Unit = { + val name = beforeFilename.replaceFirst("^.+/(.+)\\.js$", "$1") + Util.assertJs(name, after, expect) + } def assertOutputContains(frags: String*)(implicit l: Line): Unit = for (frag <- frags) @@ -45,9 +47,8 @@ final case class Babel(before : String, Util.readOrCreateFile(filename, after) match { case None => s"Created $filename" case Some(e) => - val actual = preCmpHack.runAnon(after).content - val expect = preCmpHack.runAnon(e).content - assertMultiline(actual, expect) + val name = filename.replaceFirst("^.+/(.+?)(-out[23]?)?\\.js$", "$1") + Util.assertJs(name, after, e, preCmpHack) } } diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/MutableVirtualFile.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/MutableVirtualFile.scala index e52ff3872..480b1bbeb 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/MutableVirtualFile.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/MutableVirtualFile.scala @@ -6,7 +6,7 @@ import java.util.regex.Pattern import scala.util.matching.Regex class MutableVirtualFile(val filenameOption: Option[String], val originalContent: String) { - import MutableVirtualFile.StringFilterDsl + import MutableVirtualFile.{LineTarget, StringFilterDsl} var content = originalContent @@ -27,9 +27,22 @@ class MutableVirtualFile(val filenameOption: Option[String], val originalContent def modifyLinesIterator(f: Iterator[String] => Iterator[String]): this.type = set(f(content.linesIterator).mkString("\n") + "\n") + def prepend(prefix: String): this.type = + set(prefix + content) + + def prependLine(newLine: String): this.type = + set(newLine + "\n" + content) + def +=(newLine: String): this.type = set(content + "\n" + newLine) + def addLine(newLine: String, where: LineTarget): this.type = + where match { + case LineTarget.Start => prependLine(newLine) + case LineTarget.End => this += newLine + case LineTarget.Both => prependLine(newLine) += newLine + } + def dropLines(n: Int): this.type = modifyLinesIterator(_.drop(n)) @@ -76,6 +89,13 @@ class MutableVirtualFile(val filenameOption: Option[String], val originalContent def trim(): Unit = set(content.trim + "\n") + + def descSize(): String = { + val bytes = content.length + val total = content.linesIterator.size + val nonblank = content.linesIterator.count(_.trim.nonEmpty) + s"$total lines, $nonblank non-blank, $bytes bytes" + } } object MutableVirtualFile { @@ -102,4 +122,11 @@ object MutableVirtualFile { def apply(p: Pattern): A = apply(p.matcher(_).matches()) } + + sealed trait LineTarget + object LineTarget { + case object Start extends LineTarget + case object End extends LineTarget + case object Both extends LineTarget + } } diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala index 5d0d75523..66df409ad 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala @@ -1,5 +1,7 @@ package japgolly.scalajs.react.test.emissions.util +import japgolly.scalajs.react.test.emissions.util.MutableVirtualFile.LineTarget + // We're gonna inherit like it's 1999 baby! 🥳 class TestJs(val name: String, val filename: String, originalContent: String) extends MutableVirtualFile(Some(filename), originalContent) { @@ -7,6 +9,9 @@ class TestJs(val name: String, val filename: String, originalContent: String) def this(name: String, filename: String) = this(name, filename, Util.needFileContent(filename)) + def run(h: TestJs.Hack): Unit = + h.run(this) + trim() } @@ -20,8 +25,14 @@ object TestJs { def unless(f: TestJs => Boolean): Hack = when(!f(_)) def disable : Hack = Hack.none - def runAnon(jsContent: String): TestJs = { - val js = new TestJs("anon", "anon.js", jsContent) + def runAnon(jsContent: String): TestJs = + runAs("", "anon.js", jsContent) + + def runAs(name: String, jsContent: String): TestJs = + runAs(name, if (name.endsWith(".js")) name else name + ".js", jsContent) + + def runAs(name: String, filename: String, jsContent: String): TestJs = { + val js = new TestJs(name, filename, jsContent) run(js) js } @@ -46,14 +57,23 @@ object TestJs { .replace("$less$up", "") .replace("japgolly_scalajs_react_", "sjr_") .replace("japgolly$scalajs$react$", "sjr$") + .replaceAll("\\$\\d+", "\\$0") // change `this$24` etc into just `this$0` .replaceAll("scala_scalajs_runtime_(?=AnonFunction|WrappedVarArgs)", "") ) .filterNot(objectInit) ) } - // Hacks to apply before comparison, so that tests consitently pass - val comparisonHacks: Hack = + def addName(where: LineTarget): Hack = + apply { js => + if (js.name.nonEmpty) + js.addLine(s"// Name: ${js.name}", where) + } + + def addSizeDetails(where: LineTarget): Hack = + apply(js => js.addLine(s"// ${js.descSize()}", where)) + + private val comparisonHacks: Hack = apply(_ .filterNot(_ startsWith "import ") .modify(_ @@ -61,7 +81,14 @@ object TestJs { ) ) - val forComparison: Hack = - humanReadable >> comparisonHacks + // Hacks to apply before comparison so that + // 1) tests consitently pass + // 2) lots of irrelevant noise is filtered out when presenting failures + val forComparison: Hack = ( + humanReadable + >> comparisonHacks + >> addSizeDetails(LineTarget.End) + >> addName(LineTarget.End) + ) } } diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Util.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Util.scala index 4906d2b27..43b9fe1e2 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Util.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Util.scala @@ -1,15 +1,113 @@ package japgolly.scalajs.react.test.emissions.util +import japgolly.microlibs.testutil.TestUtil._ import japgolly.microlibs.utils.FileUtils import java.io.{File, FileNotFoundException} import java.nio.file.Files -import scala.annotation.tailrec +import scala.annotation._ import scala.io.Source import scala.sys.process._ import scala.util.Try +import sourcecode.Line object Util { + def assertJs(actual: String, expect: String)(implicit l: Line): Unit = + assertJs("", actual, expect) + + def assertJs(name: String, actual: String, expect: String)(implicit l: Line): Unit = + assertJs(name, actual, expect, TestJs.Hack.forComparison) + + def assertJs(actual: String, expect: String, preCmpHack: TestJs.Hack)(implicit l: Line): Unit = + assertJs("", actual, expect, preCmpHack) + + def assertJs(name: String, actual: String, expect: String, preCmpHack: TestJs.Hack)(implicit l: Line): Unit = { + val a = preCmpHack.runAs(name, actual).content + val e = preCmpHack.runAs(name, expect).content + assertMultiline(name, actual = a, expect = e) + } + + // TODO: Update microlibs + // private def assertMultiline(actual: String, expect: String)(implicit q: Line): Unit = + // _assertMultiline(None, actual, expect) + + private def assertMultiline(name: => String, actual: String, expect: String)(implicit q: Line): Unit = + _assertMultiline(Some(name), actual, expect) + + private def _assertMultiline(name: => Option[String], actual: String, expect: String)(implicit q: Line): Unit = + if (actual != expect) withAtomicOutput { +import scala.io.AnsiColor._ +import japgolly.microlibs.testutil.TestUtilInternals._ +import japgolly.microlibs.testutil.LineDiff + println() + val AE = List(actual, expect).map(_.split("\n")) + val List(as, es) = AE : @nowarn + val lim = as.length max es.length + val List(maxAllA,_) = AE.map(x => (0 :: x.iterator.map(_.length).toList).max) : @nowarn + // val mismtachingLines = (as.iterator.zip(es.iterator)).filter { case (a,e) => a !=* e }.toList + // val maxDiffA = (0 :: mismtachingLines.map(_._1.length)).max + // val maxLimitA = 80 + // val maxA = if (maxAllA <= maxLimitA) maxAllA else if (maxLimitA >= maxDiffA) maxLimitA else maxDiffA + val maxLimitA = 100 // TODO: Make configurable by moving into config class + // TODO: Make colours configurable by moving into config class + // TODO: Make diffing logic configurable by moving into config class + val maxA = maxAllA min maxLimitA + val maxL = lim.toString.length + if (maxL == 0 || maxA == 0) + assertEqO(name, actual, expect) + else { + val nameSuffix = name.fold(RESET)(s":$RESET " + _) + val fmtWSA = RED_B + BLACK + val fmtWSE = GREEN_B + BLACK + val fmtKOA = BLACK_B + BOLD_BRIGHT_RED + val fmtKOE = BLACK_B + BOLD_BRIGHT_GREEN + val cmp = if (as.length == es.length) "|" else if (as.length > es.length) ">" else "<" + println(s"${BRIGHT_YELLOW}assertMultiline$nameSuffix (${fmtKOA}actual$RESET $cmp ${fmtKOE}expect$RESET)") + + if (as.length == es.length) { + val fmtOK = s"${BRIGHT_BLACK}%${maxL}d: %-${maxA}s | | %s${RESET}\n" + val fmtWS = s"${WHITE}%${maxL}d: ${fmtWSA}%-${maxA}s${RESET}${WHITE} |≈| ${fmtWSE}%s${RESET}\n" + val fmtKO = s"${WHITE}%${maxL}d: ${fmtKOA}%-${maxA}s${RESET}${WHITE} |≠| ${fmtKOE}%s${RESET}\n" + def removeWhitespace(s: String) = s.filterNot(_.isWhitespace) + for (i <- 0 until lim) { + val List(a, e) = AE.map(s => if (i >= s.length) "" else s(i)) : @nowarn + + // val (fmt, a2, e2) = + // if (a == e) + // (fmtOK, a.take(maxA), e.take(maxA)) + // else if (removeWhitespace(a) == removeWhitespace(e)) + // (fmtWS, a.take(maxA), e.take(maxA)) + // else + // (fmtKO, a, e) + // printf(fmt, i + 1, a2, e2) + + val (fmt, truncate) = + if (a == e) + (fmtOK, true) // TODO: Make `true` configurable by moving into config class + else if (removeWhitespace(a) == removeWhitespace(e)) + (fmtWS, true) // TODO: Make `true` configurable by moving into config class + else + (fmtKO, false) // TODO: Make `true` configurable by moving into config class + + val l = i + 1 + val w = maxA + @tailrec def go(x: String, y: String): Unit = { + printf(fmt, l, x.take(w), y.take(w)) + val hasMore = (x.length max y.length) > w + if (hasMore && !truncate) + go(x.drop(w), y.drop(w)) + } + go(a, e) + } + } else { + println(LineDiff(expect, actual).expectActualColoured) + println(BRIGHT_YELLOW + ("-" * 120) + RESET) + } + println() + fail("assertMultiline failed.") + } + } + def containsRR(content: String): Boolean = content.contains("$RefreshSig$") || content.contains("$RefreshReg$") From 84d666609aa5cdb4ee91f06f7d74801a450d1bc0 Mon Sep 17 00:00:00 2001 From: David Barri Date: Fri, 10 Jun 2022 18:40:34 +1000 Subject: [PATCH 32/72] Add `renderDebug` --- .../scalajs/react/hooks/HookMacros.scala | 14 ++++++-- .../react/hooks/HookMacrosTraits.scala | 3 ++ .../scalajs/react/hooks/HookMacros.scala | 36 ++++++++++++++++--- .../react/hooks/HookMacrosTraits.scala | 15 ++++---- .../react/hooks/AbstractHookMacros.scala | 2 +- 5 files changed, 56 insertions(+), 14 deletions(-) diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala index 43e154d8a..97f258e61 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -125,12 +125,22 @@ class HookMacros(val c: Context) extends MacroUtils { def render[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] (f: c.Tree)(step: c.Tree, s: c.Tree) - (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = { + (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = + _render(f, step, s, false)(P, C) + + def renderDebug[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] + (f: c.Tree)(step: c.Tree, s: c.Tree) + (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = + _render(f, step, s, true)(P, C) + + def _render[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] + (f: c.Tree, step: c.Tree, s: c.Tree, debug: Boolean) + (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = { val hookMacros = new HookMacrosImpl import hookMacros.log - log.enabled = false // showCode(c.macroApplication).contains("DEBUG") + log.enabled = debug log.header() val rewriteAttempt = diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacrosTraits.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacrosTraits.scala index ed17a1a18..12c2b3cc8 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacrosTraits.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacrosTraits.scala @@ -19,4 +19,7 @@ trait ApiSecondaryWithRenderMacros[P, C <: Children, Ctx, CtxFn[_], Step <: Subs final override def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = macro HookMacros.render[P, C, Ctx, CtxFn, Step] + + final def renderDebug(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = + macro HookMacros.renderDebug[P, C, Ctx, CtxFn, Step] } diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala index 12c708655..e2caed3ea 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala @@ -125,18 +125,44 @@ object HookMacros { // https://github.com/lampepfl/dotty/issues/15357 inline def renderWorkaround[ P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u] - ](inline self: PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step], - inline f : CtxFn[VdomNode], - inline step : Step, - inline s : CtorType.Summoner.Aux[Box[P], C, CT], + ](self : PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step], + f : CtxFn[VdomNode], + step : Step, + s : CtorType.Summoner.Aux[Box[P], C, CT], ): Component[P, CT] = ${ renderMacro[P, C, Ctx, CtxFn, Step, CT]('self, 'f, 'step, 's) } + inline def renderWorkaroundDebug[ + P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u] + ](self : PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step], + f : CtxFn[VdomNode], + step : Step, + s : CtorType.Summoner.Aux[Box[P], C, CT], + ): Component[P, CT] = + ${ renderMacroDebug[P, C, Ctx, CtxFn, Step, CT]('self, 'f, 'step, 's) } + def renderMacro[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]] (self: Expr[PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step]], f : Expr[CtxFn[VdomNode]], step : Expr[Step], s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], + )(using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], CtxFn: Type[CtxFn], Step: Type[Step]): Expr[Component[P, CT]] = + _renderMacro(self, f, step, s, false) + + def renderMacroDebug[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]] + (self: Expr[PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step]], + f : Expr[CtxFn[VdomNode]], + step : Expr[Step], + s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], + )(using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], CtxFn: Type[CtxFn], Step: Type[Step]): Expr[Component[P, CT]] = + _renderMacro(self, f, step, s, true) + + def _renderMacro[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]] + (self: Expr[PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step]], + f : Expr[CtxFn[VdomNode]], + step : Expr[Step], + s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], + debug: Boolean, )(using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], CtxFn: Type[CtxFn], Step: Type[Step]): Expr[Component[P, CT]] = { import quotes.reflect.* @@ -144,7 +170,7 @@ object HookMacros { val hookMacros = HookMacrosImpl(q) import hookMacros.{log, HookStep} - log.enabled = false // f.show.contains("DEBUG") + log.enabled = debug // f.show.contains("DEBUG") log.header() val renderStep = diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala index 425909f0c..64e56d204 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala @@ -22,10 +22,13 @@ trait ApiSecondaryWithRenderMacrosBinCompat[P, C <: Children, Ctx, CtxFn[_], _St render(step.squash(f)(_)) } - trait ApiSecondaryWithRenderMacros[P, C <: Children, Ctx, CtxFn[_], _Step <: SubsequentStep[Ctx, CtxFn]] - extends ApiSecondaryWithRenderMacrosBinCompat[P, C, Ctx, CtxFn, _Step] { - self: PrimaryWithRender[P, C, Ctx, _Step] with Secondary[Ctx, CtxFn, _Step] => +trait ApiSecondaryWithRenderMacros[P, C <: Children, Ctx, CtxFn[_], _Step <: SubsequentStep[Ctx, CtxFn]] + extends ApiSecondaryWithRenderMacrosBinCompat[P, C, Ctx, CtxFn, _Step] { + self: PrimaryWithRender[P, C, Ctx, _Step] with Secondary[Ctx, CtxFn, _Step] => + + inline override final def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = + HookMacros.renderWorkaround[P, C, Ctx, CtxFn, Step, s.CT](this, f, step, s) - inline override final def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = - HookMacros.renderWorkaround[P, C, Ctx, CtxFn, Step, s.CT](this, f, step, s) - } + inline final def renderDebug(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = + HookMacros.renderWorkaroundDebug[P, C, Ctx, CtxFn, Step, s.CT](this, f, step, s) +} diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala index 44b8bc779..a17522db2 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala @@ -294,7 +294,7 @@ trait AbstractHookMacros { log("rewriteRender:" + step.name, step) step.name match { - case "render" => + case "render" | "renderDebug" => val List(List(renderFn), _) = step.args : @nowarn Right(b => call(renderFn, b.args())) From 386f6a7db3f82fa4d96a2be872c28cdc5bbd9f10 Mon Sep 17 00:00:00 2001 From: David Barri Date: Fri, 10 Jun 2022 18:40:56 +1000 Subject: [PATCH 33/72] Turn rewrite failures into compiler warnings --- .../main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala | 2 +- .../main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala index 97f258e61..9c9eb0cf6 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -165,7 +165,7 @@ class HookMacros(val c: Context) extends MacroUtils { """) case Left(err) => - log(err()) // TODO: make a proper warning? + c.warning(c.enclosingPosition, err()) val self = c.prefix q""" val f = $step.squash($f) diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala index e2caed3ea..55006a7ee 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala @@ -204,7 +204,7 @@ object HookMacros { } case Left(err) => - log("Rewrite failure", err()) // TODO: make a proper warning? + report.warning(err()) '{ $self.render($step.squash($f)(_))($s) } } From 13b904138da35c9cfc1c7e9f61ed19d3f2bf58c7 Mon Sep 17 00:00:00 2001 From: David Barri Date: Fri, 10 Jun 2022 18:53:26 +1000 Subject: [PATCH 34/72] Support function refs in rewrite args --- .../scalajs/react/hooks/HookMacros.scala | 17 +- .../scalajs/react/hooks/HookMacros.scala | 22 +++ .../react/hooks/AbstractHookMacros.scala | 3 +- .../test/emissions/HooksWithScalaFns.scala | 37 ++++ .../test/emissions/HooksWithScalaFns.scala | 37 ++++ .../react/test/emissions/HooksWithJsFns.scala | 35 ++++ .../scalajs/react/test/emissions/Main.scala | 2 + .../resources/rr-sjr/HooksWithJsFns-out2.js | 149 +++++++++++++++ .../resources/rr-sjr/HooksWithJsFns-out3.js | 154 ++++++++++++++++ .../rr-sjr/HooksWithScalaFns-out2.js | 141 ++++++++++++++ .../rr-sjr/HooksWithScalaFns-out3.js | 174 ++++++++++++++++++ .../test/emissions/ReactRefreshTest.scala | 2 + 12 files changed, 770 insertions(+), 3 deletions(-) create mode 100644 library/testEmissions/js/src/main/scala-2/japgolly/scalajs/react/test/emissions/HooksWithScalaFns.scala create mode 100644 library/testEmissions/js/src/main/scala-3/japgolly/scalajs/react/test/emissions/HooksWithScalaFns.scala create mode 100644 library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksWithJsFns.scala create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out2.js create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out3.js create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out2.js create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out3.js diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala index 9c9eb0cf6..1f2b4cdbb 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -58,8 +58,21 @@ class HookMacros(val c: Context) extends MacroUtils { override val FunctionLike = new FunctionExtractor { override def unapply(a: Term) = a match { - case Function(params, _) => Some(params.size) - case _ => None + + case Function(params, _) => + Some(params.size) + + case Apply(ta@ TypeApply(_, targs), _) if ta.tpe.resultType.typeSymbol.name.toString.startsWith("Function") => + Some(targs.size - 1) + + case s: Select => + s.tpe match { + case TypeRef(_, f, args) if f.name.toString.startsWith("Function") => Some(args.size - 1) + case _ => None + } + + case _ => + None } } diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala index 55006a7ee..a1847fbfb 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala @@ -83,8 +83,30 @@ object HookMacros { override val FunctionLike = new FunctionExtractor { override def unapply(function: Term) = function match { + + case Apply(TypeApply(f, args), _) if f.tpe.show.startsWith("scala.scalajs.js.Any.toFunction") => + Some(args.size - 1) + case Block(List(DefDef(_, List(TermParamClause(params)), _, Some(_))), Closure(Ident(_), _)) => Some(params.size) + + case i@ Ident(_) => + i.symbol.tree match { + case d: DefDef => byTypeTree(d.returnTpt) + case v: ValDef => byTypeTree(v.tpt) + case _ => None + } + + case _ => + None + } + + private def byTypeTree(tpt: TypeTree): Option[Success] = + byTypeRepr(tpt.tpe) + + private def byTypeRepr(t: TypeRepr): Option[Success] = t match { + case AppliedType(TypeRef(ThisType(_), f), args) if f.startsWith("Function") => + Some(args.size - 1) case _ => None } diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala index a17522db2..d4292feb2 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala @@ -123,7 +123,8 @@ trait AbstractHookMacros { protected val FunctionLike: FunctionExtractor protected abstract class FunctionExtractor { - def unapply(function: Term): Option[Int] + final type Success = Int + def unapply(function: Term): Option[Success] } protected def showRaw(t: Term): String diff --git a/library/testEmissions/js/src/main/scala-2/japgolly/scalajs/react/test/emissions/HooksWithScalaFns.scala b/library/testEmissions/js/src/main/scala-2/japgolly/scalajs/react/test/emissions/HooksWithScalaFns.scala new file mode 100644 index 000000000..0f3ae70d7 --- /dev/null +++ b/library/testEmissions/js/src/main/scala-2/japgolly/scalajs/react/test/emissions/HooksWithScalaFns.scala @@ -0,0 +1,37 @@ +package japgolly.scalajs.react.test.emissions + +import japgolly.scalajs.react._ +import japgolly.scalajs.react.hooks.HookCtx +import japgolly.scalajs.react.vdom.html_<^._ + +object HooksWithScalaFns { + + private type US = Hooks.UseState[Int] + + private def state0() = + 123 + + private def state1(p: Int, s: US) = + p + s.value + + private val state2: HookCtx.P2[Int, US, US] => Int = + $ => $.props + $.hook1.value + $.hook2.value + + private val state3: (Int, US, US, US) => Int = + _ + _.value + _.value + _.value + + private def render(p: Int, s1: US, s2: US, s3: US, s4: US) = { + val sum = p + s1.value + s2.value + s3.value + s4.value + <.button( + "Sum = ", sum, + ^.onClick --> s1.modState(_ + 1), + ) + } + + val Component = ScalaFnComponent.withHooks[Int] + .useState(state0()) + .useStateBy(state1(_, _)) + .useStateBy(state2) + .useStateBy(state3) + .render(render _) +} diff --git a/library/testEmissions/js/src/main/scala-3/japgolly/scalajs/react/test/emissions/HooksWithScalaFns.scala b/library/testEmissions/js/src/main/scala-3/japgolly/scalajs/react/test/emissions/HooksWithScalaFns.scala new file mode 100644 index 000000000..87088bddf --- /dev/null +++ b/library/testEmissions/js/src/main/scala-3/japgolly/scalajs/react/test/emissions/HooksWithScalaFns.scala @@ -0,0 +1,37 @@ +package japgolly.scalajs.react.test.emissions + +import japgolly.scalajs.react._ +import japgolly.scalajs.react.hooks.HookCtx +import japgolly.scalajs.react.vdom.html_<^._ + +object HooksWithScalaFns { + + private type US = Hooks.UseState[Int] + + private def state0() = + 123 + + private def state1(p: Int, s: US) = + p + s.value + + private val state2: HookCtx.P2[Int, US, US] => Int = + $ => $.props + $.hook1.value + $.hook2.value + + private val state3: (Int, US, US, US) => Int = + _ + _.value + _.value + _.value + + private def render(p: Int, s1: US, s2: US, s3: US, s4: US) = { + val sum = p + s1.value + s2.value + s3.value + s4.value + <.button( + "Sum = ", sum, + ^.onClick --> s1.modState(_ + 1), + ) + } + + val Component = ScalaFnComponent.withHooks[Int] + .useState(state0()) + .useStateBy(state1) + .useStateBy(state2) + .useStateBy(state3) + .render(render) +} diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksWithJsFns.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksWithJsFns.scala new file mode 100644 index 000000000..f38ed39b1 --- /dev/null +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksWithJsFns.scala @@ -0,0 +1,35 @@ +package japgolly.scalajs.react.test.emissions + +import japgolly.scalajs.react._ +import japgolly.scalajs.react.hooks.HookCtx +import japgolly.scalajs.react.vdom.html_<^._ +import scala.scalajs.js + +object HooksWithJsFns { + + private type US = Hooks.UseState[Int] + + private def jsState0() = + 123 + + private def jsState1: js.Function2[Int, US, Int] = + _ + _.value + + private val jsState2: js.Function1[HookCtx.P2[Int, US, US], Int] = + $ => $.props + $.hook1.value + $.hook2.value + + private def render: js.Function4[Int, US, US, US, VdomNode] = + (p, s1, s2, s3) => { + val sum = p + s1.value + s2.value + s3.value + <.button( + "Sum = ", sum, + ^.onClick --> s1.modState(_ + 1), + ) + } + + val Component = ScalaFnComponent.withHooks[Int] + .useState(jsState0()) + .useStateBy(jsState1) + .useStateBy(jsState2) + .render(render) +} diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala index e6263a6df..278fc802b 100644 --- a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala @@ -15,6 +15,8 @@ object Main { private val Component = ScalaFnComponent[Unit] { _ => <.div( HooksWithChildren.Component(0)(<.div), + HooksWithJsFns.Component(0), + HooksWithScalaFns.Component(0), UseState.Component(0), UseStateWithReuse.Component(0), ) diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out2.js new file mode 100644 index 000000000..82860ec01 --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out2.js @@ -0,0 +1,149 @@ +'use strict'; + +var _s = $RefreshSig$(); + +import * as $i_react from "react"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusability from "./japgolly.scalajs.react.Reusability.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2 from "./japgolly.scalajs.react.hooks.HookCtx$P2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF from "./japgolly.scalajs.react.hooks.Hooks$UseStateF.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 from "./japgolly.scalajs.react.internal.Singleton$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024 from "./japgolly.scalajs.react.vdom.Attr$EventCallback$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode from "./japgolly.scalajs.react.vdom.VdomNode.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002eFunction1 from "./scala.Function1.js"; +import * as $j_scala$002escalajs$002ejs$002eAny$0024 from "./scala.scalajs.js.Any$.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; +import * as $j_scala$002escalajs$002eruntime$002eWrappedVarArgs from "./scala.scalajs.runtime.WrappedVarArgs.js"; + +function $p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__jsState1__sjs_js_Function2($thiz) { + return (arg1$2, arg2$2) => { + var arg1 = arg1$2 | 0; + var arg2 = arg2$2; + return $m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$().japgolly$scalajs$react$test$emissions$HooksWithJsFns$$$anonfun$jsState1$1__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__I(arg1, arg2); + }; +} + +export { $p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__jsState1__sjs_js_Function2 }; + +function $p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__render__sjs_js_Function4($thiz) { + return (arg1$2, arg2$2, arg3$2, arg4$2) => { + var arg1 = arg1$2 | 0; + var arg2 = arg2$2; + var arg3 = arg3$2; + var arg4 = arg4$2; + return $m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$().japgolly$scalajs$react$test$emissions$HooksWithJsFns$$$anonfun$render$1__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_vdom_VdomNode(arg1, arg2, arg3, arg4); + }; +} + +export { $p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__render__sjs_js_Function4 }; + +function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$() { + this.Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__f_jsState2 = null; + this.Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__f_Component = null; + $n_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$ = this; + + this.Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__f_jsState2 = arg1$2 => { + var arg1 = arg1$2; + return $m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$().japgolly$scalajs$react$test$emissions$HooksWithJsFns$$$anonfun$jsState2$1__Ljapgolly_scalajs_react_hooks_HookCtx$P2__I(arg1); + }; + + var rawComponent = arg1$2$1 => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$().japgolly$scalajs$react$test$emissions$HooksWithJsFns$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2$1); + + var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$(), null)); + this.Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$1.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$ }; +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$; + +function $h_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$ }; +$h_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$.prototype; + +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$.prototype.japgolly$scalajs$react$test$emissions$HooksWithJsFns$$$anonfun$jsState1$1__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__I = function (x$1, x$2) { + return x$1 + (x$2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0; +}; + +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$.prototype.japgolly$scalajs$react$test$emissions$HooksWithJsFns$$$anonfun$jsState2$1__Ljapgolly_scalajs_react_hooks_HookCtx$P2__I = function (δ) { + var $$x2 = δ.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + var this$1 = δ.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; + var $$x1 = this$1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]; + var this$2 = δ.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; + return (($$x2 | 0) + ($$x1 | 0) | 0) + (this$2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0; +}; + +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$.prototype.japgolly$scalajs$react$test$emissions$HooksWithJsFns$$$anonfun$render$1__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_vdom_VdomNode = function (p, s1, s2, s3) { + var sum = ((p + (s1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (s2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (s3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0; + var $$x1 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((s1$1 => () => { + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(s1$1); + return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$3$2 => { + var x$3 = x$3$2 | 0; + return 1 + x$3 | 0; + })).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline); + })(s1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]; + return $$x1.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("button", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); +}; + +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$.prototype.japgolly$scalajs$react$test$emissions$HooksWithJsFns$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box = function (props$1, hook1$1) { + return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction2__sjs_js_Function2__F2($p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__jsState1__sjs_js_Function2($m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$())).apply__O__O__O(props$1.a, hook1$1)); +}; + +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$.prototype.japgolly$scalajs$react$test$emissions$HooksWithJsFns$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box = function (hook3_ctx$1) { + return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction1__sjs_js_Function1__F1($m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$().Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__f_jsState2).apply__O__O(hook3_ctx$1)); +}; + +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$.prototype.japgolly$scalajs$react$test$emissions$HooksWithJsFns$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s(function (props) { + _s(); + + var hook1_raw = $i_react.useState(() => { + $m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$(); + return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(($m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$(), 123)); + }); + var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); + var hook2_raw = $i_react.useState(((props$1, hook1$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$().japgolly$scalajs$react$test$emissions$HooksWithJsFns$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box(props$1, hook1$1))(props, hook1)); + var hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); + var props$2 = props.a; + var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$2, hook1, hook2); + var hook3_raw = $i_react.useState((hook3_ctx$1 => () => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$().japgolly$scalajs$react$test$emissions$HooksWithJsFns$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box(hook3_ctx$1))(hook3_ctx)); + var hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); + return $j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction4__sjs_js_Function4__F4($p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__render__sjs_js_Function4($m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$())).apply__O__O__O__O__O(props.a, hook1, hook2, hook3).rawNode__sjs_js_$bar(); +}, "r+7/Q5EFFuapO5v2L90YcMjJcWo="); +var $d_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$: 0 +}, false, "japgolly.scalajs.react.test.emissions.HooksWithJsFns$", { + Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$ }; +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$; +var $n_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$; + +function $m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$) { + $n_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$ = new $c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out3.js new file mode 100644 index 000000000..8c10d9a94 --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out3.js @@ -0,0 +1,154 @@ +'use strict'; + +import * as $i_react from "react"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusability from "./japgolly.scalajs.react.Reusability.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary from "./japgolly.scalajs.react.hooks.Api$Primary.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Secondary from "./japgolly.scalajs.react.hooks.Api$Secondary.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00241 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00243 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$3.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024 from "./japgolly.scalajs.react.hooks.HookComponentBuilder$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024FirstStep from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentP$FirstStep.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024Subsequent from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentP$Subsequent.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2 from "./japgolly.scalajs.react.hooks.HookCtx$P2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.Hooks$$anon$2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; +import * as $j_japgolly$002escalajs$002ereact$002epackage$0024 from "./japgolly.scalajs.react.package$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024 from "./japgolly.scalajs.react.vdom.Attr$EventCallback$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite from "./japgolly.scalajs.react.vdom.TagLite.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagMod from "./japgolly.scalajs.react.vdom.TagMod.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode from "./japgolly.scalajs.react.vdom.VdomNode.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002eFunction1 from "./scala.Function1.js"; +import * as $j_scala$002escalajs$002ejs$002eAny$0024 from "./scala.scalajs.js.Any$.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; + +function $p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__jsState1__sjs_js_Function2($thiz) { + return (_$1, _$2) => { + var _$1$1 = _$1 | 0; + + var _$2$1 = _$2; + return _$1$1 + (_$2$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; + }; +} + +export { $p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__jsState1__sjs_js_Function2 }; + +function $p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__render__sjs_js_Function4($thiz) { + return (p, s1, s2, s3) => { + var p$1 = p | 0; + var s1$1 = s1; + var s2$1 = s2; + var s3$1 = s3; + var sum = ((p$1 + (s1$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (s2$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (s3$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; + var this$11 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self = "button"; + var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((s1$2 => () => { + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(s1$2); + var ev$1 = r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$3 => { + var _$3$1 = _$3 | 0; + + return 1 + _$3$1 | 0; + })); + return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(ev$1 === null ? null : ev$1.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline); + })(s1$1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)])); + return $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$11, self, xs); + }; +} + +export { $p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__render__sjs_js_Function4 }; + +function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$() { + this.Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__f_jsState2 = null; + this.Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__f_Component = null; + $n_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$ = this; + + this.Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__f_jsState2 = δ => { + var δ$1 = δ; + var $$x2 = δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + var this$2 = δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; + var $$x1 = this$2.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; + var this$3 = δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; + return (($$x2 | 0) + ($$x1 | 0) | 0) + (this$3.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; + }; + + $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$(); + var this$6 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024.$m_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$().apply__Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$First(); + var initialState = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => 123); + var step = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024FirstStep.$c_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$FirstStep(); + var this$8 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useState__F0__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$6, initialState, step); + var initialState$1 = $j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction2__sjs_js_Function2__F2($p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__jsState1__sjs_js_Function2(this)); + var step$1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$1(); + var this$10 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Secondary.$f_Ljapgolly_scalajs_react_hooks_Api$Secondary__useStateBy__O__Ljapgolly_scalajs_react_hooks_Api$SubsequentStep__O(this$8, initialState$1, step$1); + var initialState$2 = $j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction1__sjs_js_Function1__F1(this.Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__f_jsState2); + var step$2 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00242.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$2(); + $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useStateBy__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$10, initialState$2, step$2); + var f$proxy1 = $j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction4__sjs_js_Function4__F4($p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__render__sjs_js_Function4(this)); + new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00243.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$3(); + var s$proxy1 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); + + var rawComponent = ((this$3$1, f$proxy1$2) => { + var _s = $RefreshSig$(); + + return _s(props => { + _s(); + + var hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); + var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); + var hook2_raw = $i_react.useState(((this$2$2, props$2, hook1$2) => () => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction2__sjs_js_Function2__F2($p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__jsState1__sjs_js_Function2(this$2$2)).apply__O__O__O(props$2.a, hook1$2)))(this$3$1, props, hook1)); + var hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); + var props$1 = props.a; + var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, hook1, hook2); + var hook3_raw = $i_react.useState(((this$3$2, hook3_ctx$2) => () => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction1__sjs_js_Function1__F1(this$3$2.Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__f_jsState2).apply__O__O(hook3_ctx$2)))(this$3$1, hook3_ctx)); + var hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); + return f$proxy1$2.apply__O__O__O__O__O(props.a, hook1, hook2, hook3).rawNode__O(); + }, "FxwR6OmpTOOHvaIwXP2+wyTEVnc="); + })(this, f$proxy1); + + var $$x3 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$14 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + this.Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__f_Component = $$x3.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$14.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s$proxy1)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$ }; +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$; + +function $h_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$ }; +$h_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$.prototype; +var $d_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$: 0 +}, false, "japgolly.scalajs.react.test.emissions.HooksWithJsFns$", { + Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$ }; +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$; +var $n_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$; + +function $m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$) { + $n_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$ = new $c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out2.js new file mode 100644 index 000000000..d9080ec61 --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out2.js @@ -0,0 +1,141 @@ +'use strict'; + +var _s = $RefreshSig$(); + +import * as $i_react from "react"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusability from "./japgolly.scalajs.react.Reusability.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2 from "./japgolly.scalajs.react.hooks.HookCtx$P2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF from "./japgolly.scalajs.react.hooks.Hooks$UseStateF.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 from "./japgolly.scalajs.react.internal.Singleton$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024 from "./japgolly.scalajs.react.vdom.Attr$EventCallback$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement from "./japgolly.scalajs.react.vdom.VdomElement.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002eFunction1 from "./scala.Function1.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction4 from "./scala.scalajs.runtime.AnonFunction4.js"; +import * as $j_scala$002escalajs$002eruntime$002eWrappedVarArgs from "./scala.scalajs.runtime.WrappedVarArgs.js"; + +function $p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__state1__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__I($thiz, p, s) { + return p + (s.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0; +} + +export { $p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__state1__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__I }; + +function $p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__render__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_vdom_TagOf($thiz, p, s1, s2, s3, s4) { + var sum = (((p + (s1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (s2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (s3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (s4.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0; + var $$x1 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((s1$1 => () => { + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(s1$1); + return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$5$2 => { + var x$5 = x$5$2 | 0; + return 1 + x$5 | 0; + })).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline); + })(s1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]; + return $$x1.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("button", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); +} + +export { $p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__render__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_vdom_TagOf }; + +function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$() { + this.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state2 = null; + this.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state3 = null; + this.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_Component = null; + $n_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$ = this; + this.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state2 = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(δ$2 => { + var δ = δ$2; + var $$x2 = δ.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + var this$2 = δ.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; + var $$x1 = this$2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]; + var this$3 = δ.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; + return (($$x2 | 0) + ($$x1 | 0) | 0) + (this$3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0; + }); + this.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state3 = new $j_scala$002escalajs$002eruntime$002eAnonFunction4.$c_sjsr_AnonFunction4((x$1$2, x$2$2, x$3$2, x$4$2) => { + var x$1 = x$1$2 | 0; + var x$2 = x$2$2; + var x$3 = x$3$2; + var x$4 = x$4$2; + return ((x$1 + (x$2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (x$3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (x$4.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0; + }); + + var rawComponent = arg1$2 => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$().japgolly$scalajs$react$test$emissions$HooksWithScalaFns$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2); + + var $$x3 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$4 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$(), null)); + this.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_Component = $$x3.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$4.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$ }; +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$; + +function $h_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$ }; +$h_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$.prototype; + +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$.prototype.japgolly$scalajs$react$test$emissions$HooksWithScalaFns$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box = function (props$1, hook1$1) { + return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__state1__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__I($m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$(), props$1.a | 0, hook1$1)); +}; + +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$.prototype.japgolly$scalajs$react$test$emissions$HooksWithScalaFns$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box = function (hook3_ctx$1) { + return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$().Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state2.apply__O__O(hook3_ctx$1)); +}; + +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$.prototype.japgolly$scalajs$react$test$emissions$HooksWithScalaFns$$$anonfun$Component$5__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box = function (props$1, hook1$1, hook2$1, hook3$1) { + return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$().Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state3.apply__O__O__O__O__O(props$1.a, hook1$1, hook2$1, hook3$1)); +}; + +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$.prototype.japgolly$scalajs$react$test$emissions$HooksWithScalaFns$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s(function (props) { + _s(); + + var hook1_raw = $i_react.useState(() => { + $m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$(); + return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(($m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$(), 123)); + }); + var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); + var hook2_raw = $i_react.useState(((props$1, hook1$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$().japgolly$scalajs$react$test$emissions$HooksWithScalaFns$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box(props$1, hook1$1))(props, hook1)); + var hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); + var props$2 = props.a; + var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$2, hook1, hook2); + var hook3_raw = $i_react.useState((hook3_ctx$1 => () => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$().japgolly$scalajs$react$test$emissions$HooksWithScalaFns$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box(hook3_ctx$1))(hook3_ctx)); + var hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); + var hook4_raw = $i_react.useState(((props$1$1, hook1$1$1, hook2$1, hook3$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$().japgolly$scalajs$react$test$emissions$HooksWithScalaFns$$$anonfun$Component$5__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box(props$1$1, hook1$1$1, hook2$1, hook3$1))(props, hook1, hook2, hook3)); + var hook4 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook4_raw); + var this$3 = $p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__render__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_vdom_TagOf($m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$(), props.a | 0, hook1, hook2, hook3, hook4); + return $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement.$f_Ljapgolly_scalajs_react_vdom_VdomElement__rawNode__sjs_js_$bar(this$3); +}, "+6tsgMBzHFl0S/eNgc4PfF5XVtM="); +var $d_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$: 0 +}, false, "japgolly.scalajs.react.test.emissions.HooksWithScalaFns$", { + Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$ }; +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$; +var $n_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$; + +function $m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$) { + $n_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$ = new $c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out3.js new file mode 100644 index 000000000..8b2cf6cdb --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out3.js @@ -0,0 +1,174 @@ +'use strict'; + +import * as $i_react from "react"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusability from "./japgolly.scalajs.react.Reusability.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary from "./japgolly.scalajs.react.hooks.Api$Primary.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Secondary from "./japgolly.scalajs.react.hooks.Api$Secondary.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00241 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00243 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$3.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00244 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$4.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024 from "./japgolly.scalajs.react.hooks.HookComponentBuilder$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024FirstStep from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentP$FirstStep.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024Subsequent from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentP$Subsequent.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2 from "./japgolly.scalajs.react.hooks.HookCtx$P2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.Hooks$$anon$2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; +import * as $j_japgolly$002escalajs$002ereact$002epackage$0024 from "./japgolly.scalajs.react.package$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024 from "./japgolly.scalajs.react.vdom.Attr$EventCallback$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite from "./japgolly.scalajs.react.vdom.TagLite.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagMod from "./japgolly.scalajs.react.vdom.TagMod.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement from "./japgolly.scalajs.react.vdom.VdomElement.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002eFunction1 from "./scala.Function1.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction2 from "./scala.scalajs.runtime.AnonFunction2.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction4 from "./scala.scalajs.runtime.AnonFunction4.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction5 from "./scala.scalajs.runtime.AnonFunction5.js"; + +function $p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__state1__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__I($thiz, p, s) { + return p + (s.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; +} + +export { $p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__state1__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__I }; + +function $p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__render__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_vdom_TagOf($thiz, p, s1, s2, s3, s4) { + var sum = (((p + (s1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (s2.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (s3.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (s4.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; + var this$10 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self = "button"; + var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((s1$2 => () => { + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(s1$2); + var ev$1 = r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$5 => { + var _$5$1 = _$5 | 0; + + return 1 + _$5$1 | 0; + })); + return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(ev$1 === null ? null : ev$1.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline); + })(s1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)])); + return $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$10, self, xs); +} + +export { $p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__render__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_vdom_TagOf }; + +function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$() { + this.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state2 = null; + this.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state3 = null; + this.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_Component = null; + $n_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$ = this; + this.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state2 = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(δ => { + var δ$1 = δ; + var $$x2 = δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + var this$2 = δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; + var $$x1 = this$2.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; + var this$3 = δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; + return (($$x2 | 0) + ($$x1 | 0) | 0) + (this$3.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; + }); + this.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state3 = new $j_scala$002escalajs$002eruntime$002eAnonFunction4.$c_sjsr_AnonFunction4((_$1, _$2, _$3, _$4) => { + var _$1$1 = _$1 | 0; + + var _$2$1 = _$2; + var _$3$1 = _$3; + var _$4$1 = _$4; + return ((_$1$1 + (_$2$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (_$3$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (_$4$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; + }); + $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$(); + var this$6 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024.$m_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$().apply__Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$First(); + var initialState = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => 123); + var step = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024FirstStep.$c_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$FirstStep(); + var this$8 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useState__F0__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$6, initialState, step); + var initialState$1 = new $j_scala$002escalajs$002eruntime$002eAnonFunction2.$c_sjsr_AnonFunction2((this$4$1 => (p, s) => { + var p$1 = p | 0; + var s$1 = s; + return $p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__state1__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__I(this$4$1, p$1, s$1); + })(this)); + var step$1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$1(); + var this$10 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Secondary.$f_Ljapgolly_scalajs_react_hooks_Api$Secondary__useStateBy__O__Ljapgolly_scalajs_react_hooks_Api$SubsequentStep__O(this$8, initialState$1, step$1); + var initialState$2 = this.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state2; + var step$2 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00242.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$2(); + var this$12 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useStateBy__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$10, initialState$2, step$2); + var initialState$3 = this.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state3; + var step$3 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00243.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$3(); + $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Secondary.$f_Ljapgolly_scalajs_react_hooks_Api$Secondary__useStateBy__O__Ljapgolly_scalajs_react_hooks_Api$SubsequentStep__O(this$12, initialState$3, step$3); + var f$proxy1 = new $j_scala$002escalajs$002eruntime$002eAnonFunction5.$c_sjsr_AnonFunction5((this$5$1 => (p$2, s1, s2, s3, s4) => { + var p$3 = p$2 | 0; + var s1$1 = s1; + var s2$1 = s2; + var s3$1 = s3; + var s4$1 = s4; + return $p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__render__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_vdom_TagOf(this$5$1, p$3, s1$1, s2$1, s3$1, s4$1); + })(this)); + new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00244.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$4(); + var s$proxy1 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); + + var rawComponent = ((this$6$1, f$proxy1$2) => { + var _s = $RefreshSig$(); + + return _s(props => { + _s(); + + var hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); + var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); + var hook2_raw = $i_react.useState(((this$2$2, props$2, hook1$2) => () => { + var $$x3 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); + var p$4 = props$2.a | 0; + return $$x3.apply__O__Ljapgolly_scalajs_react_internal_Box($p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__state1__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__I(this$2$2, p$4, hook1$2)); + })(this$6$1, props, hook1)); + var hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); + var props$1 = props.a; + var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, hook1, hook2); + var hook3_raw = $i_react.useState(((this$3$2, hook3_ctx$2) => () => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(this$3$2.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state2.apply__O__O(hook3_ctx$2)))(this$6$1, hook3_ctx)); + var hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); + var hook4_raw = $i_react.useState(((this$4$2, props$3, hook1$3, hook2$2, hook3$2) => () => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(this$4$2.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state3.apply__O__O__O__O__O(props$3.a, hook1$3, hook2$2, hook3$2)))(this$6$1, props, hook1, hook2, hook3)); + var hook4 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook4_raw); + var this$16 = f$proxy1$2.apply__O__O__O__O__O__O(props.a, hook1, hook2, hook3, hook4); + return this$16.rawElement__Ljapgolly_scalajs_react_facade_React$Element(); + }, "utTcF5dA/IeeOyCNxp/nYadVY3U="); + })(this, f$proxy1); + + var $$x4 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$17 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + this.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_Component = $$x4.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$17.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s$proxy1)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$ }; +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$; + +function $h_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$ }; +$h_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$.prototype; +var $d_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$: 0 +}, false, "japgolly.scalajs.react.test.emissions.HooksWithScalaFns$", { + Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$ }; +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$; +var $n_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$; + +function $m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$) { + $n_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$ = new $c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$ }; diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala index 2884a1901..19d9fb022 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala @@ -19,6 +19,8 @@ object ReactRefreshTest extends TestSuite { } "sjr" - { + "HooksWithJsFns" - testScala() + "HooksWithScalaFns" - testScala() "HooksWithChildren" - testScala() "UseState" - testScala() "UseStateWithReuse" - testScala() From f0f87f92e0374b2ca2e5b65e4faa5a49ab587353 Mon Sep 17 00:00:00 2001 From: David Barri Date: Mon, 13 Jun 2022 13:24:58 +1000 Subject: [PATCH 35/72] Validate react-refresh version --- .../test/emissions/ReactRefreshTest.scala | 41 +++++++++++++++++++ .../react/test/emissions/util/Node.scala | 9 ++-- 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala index 19d9fb022..8d4ae4da9 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala @@ -4,6 +4,7 @@ import japgolly.microlibs.testutil.TestUtil._ import japgolly.microlibs.utils.FileUtils import japgolly.scalajs.react.test.emissions.util._ import scala.annotation.nowarn +import scala.Console._ import scala.util.Try import utest._ import utest.framework.TestPath @@ -12,6 +13,8 @@ object ReactRefreshTest extends TestSuite { override def tests = Tests { + "version" - validateReactRefreshVersion() + "js" - { "fn" - testJs() "hooks" - testJs() @@ -29,8 +32,45 @@ object ReactRefreshTest extends TestSuite { // =================================================================================================================== + private var globalFailure = Option.empty[RuntimeException] + + private def ignoreReactRefreshUpdate(ver: String): Boolean = { + val ignore = Set[String]("0.13.0") + ignore.contains(ver) + } + + private def validateReactRefreshVersion(): Any = { + val r = Node.run("npm", "outdated") + r.exitStatus match { + case 0 => + // everything is up to date + case 1 => + r.out.linesIterator.find(_ startsWith "react-refresh ") match { + case None => + // react-refresh is up to date + case Some(line) => + val latest = line.split("\\s+")(3) + val msg = s"react-refresh is out-of-date. Latest version is $YELLOW_B$latest$RESET" + if (ignoreReactRefreshUpdate(latest)) + msg // render as test output + else { + val e = new RuntimeException(msg) + globalFailure = Some(e) + throw e + } + } + case _ => + r.assertExitStatus() + } + } + + private def preTest(): Unit = + globalFailure.foreach(throw _) + /** Load a JS file in /resources/, run ReactRefresh transforms over it, and confirm the result. */ protected def testJs()(implicit tp: TestPath) = { + preTest() + val dir = Props.resSubdirJsRR val name = tp.value.last val base = s"${Props.testResDir}/$dir/$name" @@ -88,6 +128,7 @@ object ReactRefreshTest extends TestSuite { onShow : TestJs.Hack = TestJs.Hack.humanReadable, expectedFrags : Seq[String] = Seq.empty) (implicit tp : TestPath) = { + preTest() val pkg = Props.rootPkg val name = tp.value.last diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Node.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Node.scala index 66cbc42a4..3522f976c 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Node.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Node.scala @@ -18,10 +18,13 @@ object Node { throw new ExceptionInInitializerError(s"`${cmd.mkString(" ")}` exited with $code") } - def babel(args: String*): String = { + def run(cmd: String*): ProcessResult = { val _ = init - val cmd = Seq("./node_modules/.bin/babel") ++ args - val res = ProcessResult(cmd, dir) + ProcessResult(cmd, dir) + } + + def babel(args: String*): String = { + val res = run(("./node_modules/.bin/babel" +: args): _*) res.assertExitStatus() res.out } From 3a753839f35e9fa5de5cf2b1cae02eacf5af3ac3 Mon Sep 17 00:00:00 2001 From: David Barri Date: Mon, 13 Jun 2022 13:30:07 +1000 Subject: [PATCH 36/72] Upgrade to react-refresh 0.13.0 --- library/testEmissions/jvm/src/test/node/babel.dev.json | 2 +- library/testEmissions/jvm/src/test/node/package.json | 2 +- .../scalajs/react/test/emissions/ReactRefreshTest.scala | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/library/testEmissions/jvm/src/test/node/babel.dev.json b/library/testEmissions/jvm/src/test/node/babel.dev.json index 91c5c13f8..3b9fe4d9a 100644 --- a/library/testEmissions/jvm/src/test/node/babel.dev.json +++ b/library/testEmissions/jvm/src/test/node/babel.dev.json @@ -1,6 +1,6 @@ { "presets": [], "plugins": [ - "react-refresh/cjs/react-refresh-babel.development" + "react-refresh/babel" ] } \ No newline at end of file diff --git a/library/testEmissions/jvm/src/test/node/package.json b/library/testEmissions/jvm/src/test/node/package.json index 8108400a5..41dbf2dda 100644 --- a/library/testEmissions/jvm/src/test/node/package.json +++ b/library/testEmissions/jvm/src/test/node/package.json @@ -5,6 +5,6 @@ "dependencies": { "@babel/cli": "^7.17.6", "@babel/core": "^7.17.5", - "react-refresh": "^0.11.0" + "react-refresh": "^0.13.0" } } diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala index 8d4ae4da9..1bac5d13b 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala @@ -35,7 +35,7 @@ object ReactRefreshTest extends TestSuite { private var globalFailure = Option.empty[RuntimeException] private def ignoreReactRefreshUpdate(ver: String): Boolean = { - val ignore = Set[String]("0.13.0") + val ignore = Set[String]() ignore.contains(ver) } From 065ddb371d7f78975ec91acd45a2485abd022ebf Mon Sep 17 00:00:00 2001 From: David Barri Date: Tue, 14 Jun 2022 09:57:07 +1000 Subject: [PATCH 37/72] Support `custom*` hook methods --- .../scalajs/react/hooks/HookMacros.scala | 24 ++- .../scalajs/react/hooks/HookMacros.scala | 19 +++ .../react/hooks/AbstractHookMacros.scala | 137 +++++++++++++----- .../scalajs/react/hooks/CustomHook.scala | 3 +- .../scalajs/react/internal/MacroLogger.scala | 46 +++++- 5 files changed, 179 insertions(+), 50 deletions(-) diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala index 1f2b4cdbb..8fc5b1a66 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -27,13 +27,14 @@ class HookMacros(val c: Context) extends MacroUtils { override type HookRef = TermName override type Stmt = c.universe.Tree override type Term = c.universe.Tree - override type Type[A] = TypeTree - override type TypeTree = c.universe.Tree + override type Type[A] = c.universe.Type + override type TypeTree = c.universe.TypeTree override protected def asTerm[A](e: Expr[A]) = e override protected def Expr[A](t: Term) = t override protected def hookRefToTerm(r: HookRef) = Ident(r) - override protected def Type[A](t: TypeTree) = t + override protected def Type[A](t: TypeTree) = t.tpe + override protected def typeOfTerm(t: Term) = c.universe.TypeTree(t.tpe) override val ApplyLike = new ApplyExtractor { override def unapply(a: Term) = a match { @@ -44,7 +45,7 @@ class HookMacros(val c: Context) extends MacroUtils { override val TypeApplyLike = new TypeApplyExtractor { override def unapply(a: Term) = a match { - case TypeApply(x, y) => Some((x, y)) + case TypeApply(x, y) => Some((x, y.map(t => TypeTree(t.tpe)))) case _ => None } } @@ -121,6 +122,21 @@ class HookMacros(val c: Context) extends MacroUtils { } } + override protected def isUnit(t: TypeTree): Boolean = + t.tpe == typeOf[Unit] + + override protected def unitTerm = + q"()" + + override protected def unitType = + c.universe.definitions.UnitTpe + + override protected def custom[I, O] = (_, _, hook, i) => + q"$hook.unsafeInit($i)" + + override protected def customArg[Ctx, Arg] = (_, _, hookArg, ctx) => + q"$hookArg.convert($ctx)" + override protected def useStateFn[S] = (tpe, body) => q"$React.useStateFn(() => $Box[$tpe]($body))" diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala index a1847fbfb..cb98c5c46 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala @@ -55,6 +55,7 @@ object HookMacros { override protected def asTerm[A](e: Expr[A]) = e.asTerm override protected def Expr[A](t: Term) = t.asExprOf[Any].asInstanceOf[Expr[A]] override protected def hookRefToTerm(r: HookRef) = r.ref + override protected def typeOfTerm(t: Term) = t.tpe.asTypeTree override protected def Type[A](t: TypeTree) = { val x: scala.quoted.Type[?] = t.asType x.asInstanceOf[scala.quoted.Type[A]] @@ -129,6 +130,24 @@ object HookMacros { Term.betaReduce(t).getOrElse(t) } + override protected def isUnit(t: TypeTree): Boolean = + t.tpe.asType match { + case '[Unit] => true + case _ => false + } + + override protected def unitTerm = + '{ () } + + override protected def unitType: Type[Unit] = + scala.quoted.Type.of[Unit] + + override protected def custom[I, O] = implicit (ti, to, hook, i) => + '{ $hook.unsafeInit($i) } + + override protected def customArg[Ctx, Arg] = implicit (tc, ta, hookArg, ctx) => + '{ $hookArg.convert($ctx) } + override protected def useStateFn[S] = implicit (tpe, body) => '{ React.useStateFn(() => Box[$tpe]($body)) } diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala index d4292feb2..190c28a76 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala @@ -12,26 +12,45 @@ object AbstractHookMacros { // =================================================================================================================== // Hook Rewriter - trait HookRewriterApi[Stmt, Term, HookRef] { + trait HookRewriterApi[Stmt, Term <: Stmt, HookRef] { def +=(stmt: Stmt): Unit def args(): List[Term] - def ctxArg(): Term + def createCtxArg(): Term def hookCount(): Int def nextHookName(): String def registerHook(h: HookRef): Unit + def skipHook(): Unit def useChildren(): Unit def usesChildren(): Boolean def valDef(name: String, body: Term): HookRef def wrap(body: Term): Term + final def argsOrCreateCtxArg(paramCount: Int): List[Term] = { + val takesHookCtx = ( + hookCount() > 1 // HookCtx only provided from the second hook onwards + && paramCount == 1 // Function argument takes a single param + ) + if (takesHookCtx) + createCtxArg() :: Nil + else + args() + } + final def createRawAndHook(raw: Term, hook: HookRef => Term): HookRef = { val rawDef = valDef(raw, "_raw") - hookDef(hook(rawDef)) + createHook(hook(rawDef)) } - final def hookDef(body: Term): HookRef = + final def createHook(body: Term): HookRef = valDef(nextHookName(), body) + final def createHook(body: Term, discard: Boolean): Option[HookRef] = + if (discard) { + this += body + None + } else + Some(createHook(body)) + final def valDef(body: Term, suffix: String): HookRef = valDef(nextHookName() + suffix, body) } @@ -40,7 +59,7 @@ object AbstractHookMacros { final case class HookRewriterCtx[Stmt, Term](props: Term, initChildren: Stmt, children: Term) - trait HookRewriter[Stmt, Term, HookRef] extends HookRewriterApi[Stmt, Term, HookRef] { + trait HookRewriter[Stmt, Term <: Stmt, HookRef] extends HookRewriterApi[Stmt, Term, HookRef] { protected var stmts = Vector.empty[Stmt] private var hooks = List.empty[Term] private var _hookCount = 0 @@ -73,13 +92,16 @@ object AbstractHookMacros { _hookCount += 1 } + final override def skipHook(): Unit = + _hookCount += 1 + final override def args(): List[Term] = if (usesChildren()) ctx.props :: ctx.children :: hooks else ctx.props :: hooks - final override def ctxArg(): Term = { + final override def createCtxArg(): Term = { val create = hookCtx(usesChildren(), args()) val ctx = valDef(create, "_ctx") hookRefToTerm(ctx) @@ -97,7 +119,7 @@ trait AbstractHookMacros { type Expr[A] type HookRef type Stmt - type Term + type Term <: Stmt type Type[A] type TypeTree @@ -105,6 +127,7 @@ trait AbstractHookMacros { protected def Expr[A](t: Term): Expr[A] protected def hookRefToTerm(r: HookRef): Term protected def Type[A](t: TypeTree): Type[A] + protected def typeOfTerm(t: Term): TypeTree protected val ApplyLike: ApplyExtractor protected abstract class ApplyExtractor { @@ -133,12 +156,19 @@ trait AbstractHookMacros { def rewriter(ctx: HookRewriterCtx[Stmt, Term]): Rewriter protected def call(function: Term, args: List[Term]): Term + protected def isUnit(t: TypeTree): Boolean + protected def unitTerm: Expr[Unit] + protected def unitType: Type[Unit] + + protected def custom[I, O]: (Type[I], Type[O], Expr[CustomHook[I, O]], Expr[I]) => Expr[O] + protected def customArg[Ctx, Arg]: (Type[Ctx], Type[Arg], Expr[CustomHook.Arg[Ctx, Arg]], Expr[Ctx]) => Expr[Arg] protected def useStateFn[S]: (Type[S], Expr[S]) => Expr[React.UseState[Box[S]]] protected def useStateFromJsBoxed[S]: (Type[S], Expr[React.UseState[Box[S]]]) => Expr[Hooks.UseState[S]] protected def useStateWithReuseFromJsBoxed[S]: (Type[S], Expr[React.UseState[Box[S]]], Expr[Reusability[S]], Expr[ClassTag[S]]) => Expr[Hooks.UseStateWithReuse[S]] protected def vdomRawNode: Expr[VdomNode] => Expr[React.Node] + // ----------------------------------------------------------------------------------------------------------- // Concrete protected object AutoTypeImplicits { @@ -163,12 +193,18 @@ trait AbstractHookMacros { HookDefn(steps ::: s :: Nil) } - case class HookStep(name: String, targs: List[TypeTree], args: List[List[Term]]) + case class HookStep(name: String, targs: List[TypeTree], args: List[List[Term]]) { + def sig = (targs, args) + } private val withHooks = "withHooks" - final def parse(tree: Term): Either[() => String, HookDefn] = - _parse(tree, Nil, Nil, Nil) + final def parse(tree: Term): Either[() => String, HookDefn] = { + log.hold() + val r = _parse(tree, Nil, Nil, Nil) + log.release(printPending = r.isLeft) + r + } @tailrec private def _parse(tree: Term, targs: List[TypeTree], args: List[List[Term]], steps: List[HookStep]): Either[() => String, HookDefn] = @@ -209,16 +245,16 @@ trait AbstractHookMacros { def rewriteComponent(h: HookDefn): Either[() => String, Rewriter => Term] = { val it = h.steps.iterator var renderStep = null : HookStep - var hooks = Vector.empty[Rewriter => HookRef] + var hookFns = Vector.empty[Rewriter => Option[HookRef]] var withPropsChildren = false while (it.hasNext) { val step = it.next() if (it.hasNext) { - if (hooks.isEmpty && step.name == "withPropsChildren") + if (hookFns.isEmpty && step.name == "withPropsChildren") withPropsChildren = true else rewriteStep(step) match { - case Right(h) => hooks :+= h + case Right(h) => hookFns :+= h case Left(e) => return Left(e) } } else @@ -228,61 +264,88 @@ trait AbstractHookMacros { rewriteRender(renderStep).map { buildRender => b => if (withPropsChildren) b.useChildren() - for (h <- hooks) - b registerHook h(b) + for (hf <- hookFns) + hf(b) match { + case Some(h) => b.registerHook(h) + case None => b.skipHook() + } buildRender(b) } } - def rewriteStep(step: HookStep): Either[() => String, Rewriter => HookRef] = { + def rewriteStep(step: HookStep): Either[() => String, Rewriter => Option[HookRef]] = { log("rewriteStep:" + step.name, step) - def by[A](fn: Term)(use: (Rewriter, Term) => A): Either[() => String, Rewriter => A] = + def by[A](fn: Term)(use: (Rewriter, Term => Term) => A): Either[() => String, Rewriter => A] = fn match { case FunctionLike(paramCount) => Right { b => - val takesHookCtx = ( - b.hookCount() > 1 // HookCtx only provided from the second hook onwards - && paramCount == 1 // Function argument takes a single param - ) - val args = - if (takesHookCtx) - b.ctxArg() :: Nil - else - b.args() - use(b, call(fn, args)) + val args = b.argsOrCreateCtxArg(paramCount) + use(b, call(_, args)) } case _ => Left(() => s"Expected a function, found: ${showRaw(fn)}") } - def maybeBy[A](f: Term)(use: (Rewriter, Term) => A): Either[() => String, Rewriter => A] = + def maybeBy[A](f: Term)(use: (Rewriter, Term => Term) => A): Either[() => String, Rewriter => A] = if (step.name endsWith "By") by(f)(use) else - Right(use(_, f)) + Right(use(_, identity)) + + implicit def autoSomeHookRefs(r: HookRef): Option[HookRef] = + Some(r) import AutoTypeImplicits._ trait X step.name match { + // val (List(), List(List())) = step.sig : @nowarn + + case "custom" => + val (List(i, o), List(List(h), List(_, a, _))) = step.sig : @nowarn + Right { b => + val initHook: Term = + if (isUnit(i)) + custom[Unit, X](unitType, o, h, unitTerm) + else { + val ctxArgs = b.argsOrCreateCtxArg(1) + val List(ctxArg) = ctxArgs : @nowarn + val ctxArgType = typeOfTerm(ctxArg) + val ctx = b.valDef(customArg[X, X](ctxArgType, o, a, ctxArg), "_ctx") + custom[X, X](i, o, h, ctx) + } + b.createHook(initHook, discard = isUnit(o)) + } + + case "customBy" => + val (List(o), List(List(h), List(_, _))) = step.sig : @nowarn + by(h) { (b, withCtx) => + b.createRawAndHook( + raw = withCtx(h), + hook = custom[Unit, X](unitType, o, _, unitTerm)) + } + + // case "useMemo" | "useMemoBy" => + // val (List(d, a), List(List(deps), List(create), List(reuse, step))) = step.sig : @nowarn + // maybeBy(deps) { (b, withCtx) => + // } + case "useState" | "useStateBy" => - val List(tpe) = step.targs : @nowarn - val List(List(f), _) = step.args : @nowarn - maybeBy(f) { (b, body) => + val (List(tpe), List(List(initialState), List(_))) = step.sig : @nowarn + maybeBy(initialState) { (b, withCtx) => b.createRawAndHook( - raw = useStateFn[X](tpe, body), + raw = useStateFn[X](tpe, withCtx(initialState)), hook = useStateFromJsBoxed[X](tpe, _)) } case "useStateWithReuse" | "useStateWithReuseBy" => - val List(tpe) = step.targs : @nowarn - val List(List(f), List(ct, reuse, _)) = step.args : @nowarn - maybeBy(f) { (b, body) => + val (List(tpe), List(List(initialState), List(ct, reuse, _))) = step.sig : @nowarn + maybeBy(initialState) { (b, withCtx) => b.createRawAndHook( - raw = useStateFn[X](tpe, body), + raw = useStateFn[X](tpe, withCtx(initialState)), hook = useStateWithReuseFromJsBoxed[X](tpe, _, reuse, ct)) } diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/CustomHook.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/CustomHook.scala index 95a033d5d..2b77dd24e 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/CustomHook.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/CustomHook.scala @@ -57,13 +57,14 @@ object CustomHook { trait ArgLowPri { implicit def id[A, B >: A]: Arg[A, B] = - Arg[A, B](a => a) + Arg[A, B](a => a) } object Arg extends ArgLowPri { def const[C, I](i: I): Arg[C, I] = apply[C, I](_ => i) + implicit def exactId [A] : Arg[A, A] = apply(a => a) implicit def unit [Ctx] : Arg[Ctx, Unit] = const(()) implicit def ctxProps[P] : Arg[HookCtx.P0[P], P] = apply((_: HookCtx.P0[P]).props) implicit def ctxPropsChildren : Arg[HookCtx.PC0[Any], PropsChildren] = apply((_: HookCtx.PC0[Any]).propsChildren) diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/internal/MacroLogger.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/internal/MacroLogger.scala index fc2bacffd..634b655c5 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/internal/MacroLogger.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/internal/MacroLogger.scala @@ -36,6 +36,23 @@ class MacroLogger { enabledStack = enabledStack.tail } + private var _hold = false + private var _pending = Vector.empty[() => String] + + def hold(): Unit = { + release() + _hold = true + } + + def release(printPending: Boolean = true): Unit = { + val pending = _pending + _pending = Vector.empty + _hold = false + if (printPending && enabled) + for (p <- pending) + _println(p()) + } + def apply(): Unit = if (enabled) System.out.println() @@ -46,12 +63,21 @@ class MacroLogger { // for (line <- text.linesIterator) { // System.out.printf("%s[%3d]%s %s\n", CYAN, l.value, RESET, line) // } - System.out.printf("%s[%3d]%s %s\n", CYAN, l.value, RESET, text.replace("\n", "\n ")) + val msg = "%s[%3d]%s %s".format(CYAN, l.value, RESET, text.replace("\n", "\n ")) + _println(msg) } private def _println(a: => Any): Unit = - if (enabled) - System.out.println(a) + if (enabled) { + val msg = () => a match { + case s: String => s + case _ => "" + a + } + if (_hold) + _pending :+= msg + else + System.out.println(msg()) + } private def width = 200 private def sep = "=" * width @@ -73,11 +99,15 @@ class MacroLogger { def all(name: => Any, values: => Iterable[Any])(implicit l: Line): Unit = if (enabled) { val vs = values - val total = vs.size - var i = 0 - for (v <- vs) { - i += 1 - apply(s"$name [$i/$total]", v) + if (vs.isEmpty) + apply(s"$name [0/0]") + else { + val total = vs.size + var i = 0 + for (v <- vs) { + i += 1 + apply(s"$name [$i/$total]", v) + } } } } From 2f1851c4cc73529ae6cd3f3f755854f66f258c32 Mon Sep 17 00:00:00 2001 From: David Barri Date: Tue, 14 Jun 2022 15:20:35 +1000 Subject: [PATCH 38/72] Properly handle intermediary hooks with Unit results --- .../scalajs/react/hooks/HookMacros.scala | 37 ++- .../scalajs/react/hooks/HookMacros.scala | 38 ++- .../react/hooks/AbstractHookMacros.scala | 255 +++++++++--------- .../react/core/ScalaSpecificHooksTest.scala | 5 +- .../react/core/ScalaSpecificHooksTest.scala | 13 +- .../scalajs/react/core/HooksTest.scala | 6 +- 6 files changed, 181 insertions(+), 173 deletions(-) diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala index 8fc5b1a66..e9fe98fc4 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -24,7 +24,7 @@ class HookMacros(val c: Context) extends MacroUtils { import AbstractHookMacros._ override type Expr[A] = Term - override type HookRef = TermName + override type Ref = TermName override type Stmt = c.universe.Tree override type Term = c.universe.Tree override type Type[A] = c.universe.Type @@ -32,7 +32,7 @@ class HookMacros(val c: Context) extends MacroUtils { override protected def asTerm[A](e: Expr[A]) = e override protected def Expr[A](t: Term) = t - override protected def hookRefToTerm(r: HookRef) = Ident(r) + override protected def refToTerm(r: Ref) = Ident(r) override protected def Type[A](t: TypeTree) = t.tpe override protected def typeOfTerm(t: Term) = c.universe.TypeTree(t.tpe) @@ -80,19 +80,16 @@ class HookMacros(val c: Context) extends MacroUtils { override def showRaw(t: Term): String = c.universe.showRaw(t) override def showCode(t: Term): String = c.universe.showCode(t) - override def rewriter(rc: RewriterCtx) = - new HookRewriter[Tree, Term, HookRef] { - override protected val ctx = rc - override protected def Apply(t: Term, as: List[Term]) = c.universe.Apply(t, as) - override protected def hookRefToTerm(r: HookRef) = Ident(r) - override def valDef(n: String, t: Term) = { val r = TermName(n); this += q"val $r = $t"; r } - override def wrap(body: Term) = q"..$stmts; $body" - - override protected def hookCtx(withChildren: Boolean, args: List[Term]) = { - val obj = if (withChildren) q"$HookCtx.withChildren" else HookCtx - Apply(obj, args) - } - } + override protected def wrap = + (s, b) => q"..$s; $b" + + override protected val rewriterBridge: RewriterBridge = + HookRewriter.Bridge[Stmt, Term, Ref]( + apply = Apply(_, _), + hookCtx = (c, as) => Apply(if (c) q"$HookCtx.withChildren" else HookCtx, as), + refToTerm = r => Ident(r), + valDef = (n, t) => { val r = TermName(n); (q"val $r = $t", r) }, + ) override def call(function: Tree, args: List[Tree]): Tree = { import internal._ @@ -174,20 +171,20 @@ class HookMacros(val c: Context) extends MacroUtils { val rewriteAttempt = for { - p <- hookMacros.parse(c.macroApplication) - r <- hookMacros.rewriteComponent(p) - } yield hookMacros.applyRewrite(r) + hookDefn <- hookMacros.parse(c.macroApplication) + rewriter <- hookMacros.rewriteComponent(hookDefn) + } yield rewriter val result: Tree = rewriteAttempt match { - case Right(rewrite) => + case Right(rewriter) => val ctx = hookMacros.rewriterCtx( props = q"props.unbox", initChildren = q"val children = $PropsChildren.fromRawProps(props)", children = q"children", ) - val newBody = rewrite(ctx) + val newBody = rewriter(ctx) c.untypecheck(q""" val rawComponent: $JsFn.RawComponent[${Box(P)}] = props => $newBody $ScalaFn.fromBoxed($JsFn.fromJsFn[${Box(P)}, $C](rawComponent)($s)) diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala index cb98c5c46..c33fe0d11 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala @@ -21,21 +21,6 @@ object HookMacros { private def HookMacrosImpl(qq: Quotes): HookMacrosImpl { val q: qq.type } = new HookMacrosImpl { override implicit val q: qq.type = qq - import q.reflect.* - - override def rewriter(rctx: RewriterCtx): Rewriter = - new AbstractHookMacros.HookRewriter[Stmt, Term, HookRef] { - override protected val ctx = rctx - override protected def Apply(t: Term, as: List[Term]) = q.reflect.Apply(t, as) - override protected def hookRefToTerm(r: HookRef) = r.ref - override def valDef(n: String, t: Term) = { val r = untypedValDef(n, t.tpe, Flags.EmptyFlags)(t); this += r.valDef; r } - override def wrap(body: Term) = Block(stmts.toList, body) - - override protected def hookCtx(withChildren: Boolean, args: List[Term]) = { - val obj = if (withChildren) '{HookCtx.withChildren} else '{HookCtx} - Select.overloaded(obj.asTerm, "apply", args.map(_.tpe), args) - } - } } @nowarn("msg=Consider using canonical type reference .+Underlying instead") @@ -46,7 +31,7 @@ object HookMacros { import q.reflect.* override type Expr[A] = scala.quoted.Expr[A] - override type HookRef = UntypedValDef.WithQuotes[q.type] + override type Ref = UntypedValDef.WithQuotes[q.type] override type Stmt = q.reflect.Statement override type Term = q.reflect.Term override type Type[A] = scala.quoted.Type[A] @@ -54,13 +39,24 @@ object HookMacros { override protected def asTerm[A](e: Expr[A]) = e.asTerm override protected def Expr[A](t: Term) = t.asExprOf[Any].asInstanceOf[Expr[A]] - override protected def hookRefToTerm(r: HookRef) = r.ref + override protected def refToTerm(r: Ref) = r.ref override protected def typeOfTerm(t: Term) = t.tpe.asTypeTree override protected def Type[A](t: TypeTree) = { val x: scala.quoted.Type[?] = t.asType x.asInstanceOf[scala.quoted.Type[A]] } + override protected def wrap = + (s, b) => Block(s.toList, b) + + override protected val rewriterBridge: RewriterBridge = + HookRewriter.Bridge[Stmt, Term, Ref]( + apply = Apply(_, _), + hookCtx = (c, as) => Select.overloaded((if (c) '{HookCtx.withChildren} else '{HookCtx}).asTerm, "apply", as.map(_.tpe), as), + refToTerm = _.ref, + valDef = (n, t) => { val r = untypedValDef(n, t.tpe, Flags.EmptyFlags)(t); (r.valDef, r) }, + ) + override val ApplyLike = new ApplyExtractor { override def unapply(a: Term) = a match { case Apply(x, y) => Some((x, y)) @@ -214,14 +210,16 @@ object HookMacros { log.enabled = debug // f.show.contains("DEBUG") log.header() + // log("self", self.asTerm.underlying.show) + val renderStep = HookStep("render", Nil, List(List(f.asTerm), List(step.asTerm, s.asTerm))) val rewriteAttempt = for { - p <- hookMacros.parse(self.asTerm.underlying) - r <- hookMacros.rewriteComponent(p + renderStep) - } yield hookMacros.applyRewrite(r) + hookDefn <- hookMacros.parse(self.asTerm.underlying) + compBody <- hookMacros.rewriteComponent(hookDefn + renderStep) + } yield compBody val result: Expr[Component[P, CT]] = rewriteAttempt match { diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala index 190c28a76..4f84b6a8e 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala @@ -12,100 +12,108 @@ object AbstractHookMacros { // =================================================================================================================== // Hook Rewriter - trait HookRewriterApi[Stmt, Term <: Stmt, HookRef] { - def +=(stmt: Stmt): Unit - def args(): List[Term] - def createCtxArg(): Term - def hookCount(): Int - def nextHookName(): String - def registerHook(h: HookRef): Unit - def skipHook(): Unit - def useChildren(): Unit - def usesChildren(): Boolean - def valDef(name: String, body: Term): HookRef - def wrap(body: Term): Term - - final def argsOrCreateCtxArg(paramCount: Int): List[Term] = { + sealed trait HookRewriter[Stmt, Term <: Stmt, Ref] { + val bridge : HookRewriter.Bridge[Stmt, Term, Ref] + protected val hookNo : Int + protected val initialCtx : HookRewriter.InitialCtx[Stmt, Term] + protected val prevHooks : List[Term] + protected val usesChildren: Boolean + protected def initialStmts: Vector[Stmt] + + private var _stmts: Vector[Stmt] = + initialStmts + + protected def hookName = + "hook" + hookNo + + final def +=(stmt: Stmt): Unit = + _stmts :+= stmt + + final def args: List[Term] = + if (usesChildren) + initialCtx.props :: initialCtx.children :: prevHooks + else + initialCtx.props :: prevHooks + + final def argsOrCtxArg(paramCount: Int): List[Term] = { val takesHookCtx = ( - hookCount() > 1 // HookCtx only provided from the second hook onwards + prevHooks.nonEmpty // HookCtx only provided when previous hook results exist && paramCount == 1 // Function argument takes a single param ) if (takesHookCtx) - createCtxArg() :: Nil + ctxArg :: Nil else - args() + args } - final def createRawAndHook(raw: Term, hook: HookRef => Term): HookRef = { - val rawDef = valDef(raw, "_raw") - createHook(hook(rawDef)) + final lazy val ctxArg: Term = { + val create = bridge.hookCtx(usesChildren, args) + val ctx = valDef(create, "_ctx") + bridge.refToTerm(ctx) } - final def createHook(body: Term): HookRef = - valDef(nextHookName(), body) + final def createHook(body: Term): Ref = + valDef(body, "") - final def createHook(body: Term, discard: Boolean): Option[HookRef] = + final def createHook(body: Term, discard: Boolean): Option[Ref] = if (discard) { this += body None } else Some(createHook(body)) - final def valDef(body: Term, suffix: String): HookRef = - valDef(nextHookName() + suffix, body) - } - - // ------------------------------------------------------------------------------------------------------------------- - - final case class HookRewriterCtx[Stmt, Term](props: Term, initChildren: Stmt, children: Term) - - trait HookRewriter[Stmt, Term <: Stmt, HookRef] extends HookRewriterApi[Stmt, Term, HookRef] { - protected var stmts = Vector.empty[Stmt] - private var hooks = List.empty[Term] - private var _hookCount = 0 - private var _usesChildren = false - - protected val ctx: HookRewriterCtx[Stmt, Term] - protected def Apply(t: Term, args: List[Term]): Term - protected def hookCtx(withChildren: Boolean, args: List[Term]): Term - protected def hookRefToTerm(ref: HookRef): Term - - final override def usesChildren() = - _usesChildren - - final override def useChildren(): Unit = { - _usesChildren = true - this += ctx.initChildren + final def createRawAndHook(raw: Term, hook: Ref => Term): Ref = { + val rawDef = valDef(raw, "_raw") + createHook(hook(rawDef)) } - final override def +=(stmt: Stmt): Unit = - stmts :+= stmt - - final override def hookCount(): Int = - _hookCount + final def createRawAndHook(raw: Term, hook: Ref => Term, discard: Boolean): Option[Ref] = { + val rawDef = valDef(raw, "_raw") + createHook(hook(rawDef), discard = discard) + } - final override def nextHookName(): String = - "hook" + (hookCount() + 1) + final def stmts() = + _stmts - final override def registerHook(h: HookRef): Unit = { - hooks :+= hookRefToTerm(h) - _hookCount += 1 + final def valDef(body: Term, suffix: String): Ref = { + val x = bridge.valDef(hookName + suffix, body) + this += x._1 + x._2 } + } - final override def skipHook(): Unit = - _hookCount += 1 - - final override def args(): List[Term] = - if (usesChildren()) - ctx.props :: ctx.children :: hooks - else - ctx.props :: hooks + object HookRewriter { + + final case class InitialCtx[Stmt, Term](props: Term, initChildren: Stmt, children: Term) + + final case class Bridge[Stmt, Term, Ref]( + apply : (Term, List[Term]) => Term, + hookCtx : (Boolean, List[Term]) => Term, + refToTerm: Ref => Term, + valDef : (String, Term) => (Stmt, Ref), + ) + + def init[Stmt, Term <: Stmt, Ref](ctx : InitialCtx[Stmt, Term], + bridg : Bridge[Stmt, Term, Ref], + useChildren: Boolean): HookRewriter[Stmt, Term, Ref] = + new HookRewriter[Stmt, Term, Ref] { + override val bridge = bridg + override protected val hookNo = 1 + override protected val initialCtx = ctx + override protected val prevHooks = Nil + override protected val usesChildren = useChildren + override protected def initialStmts = if (useChildren) Vector(ctx.initChildren) else Vector.empty + } - final override def createCtxArg(): Term = { - val create = hookCtx(usesChildren(), args()) - val ctx = valDef(create, "_ctx") - hookRefToTerm(ctx) - } + def next[Stmt, Term <: Stmt, Ref](prev: HookRewriter[Stmt, Term, Ref])(newHook: Option[Ref]): HookRewriter[Stmt, Term, Ref] = + new HookRewriter[Stmt, Term, Ref] { + override val bridge = prev.bridge + override protected val hookNo = prev.hookNo + 1 + override protected val initialCtx = prev.initialCtx + override protected val prevHooks = newHook.fold(prev.prevHooks)(prev.prevHooks :+ prev.bridge.refToTerm(_)) + override protected val usesChildren = prev.usesChildren + override protected def initialStmts = prev.stmts() + } } } @@ -117,7 +125,7 @@ trait AbstractHookMacros { // Abstractions type Expr[A] - type HookRef + type Ref type Stmt type Term <: Stmt type Type[A] @@ -125,9 +133,10 @@ trait AbstractHookMacros { protected def asTerm[A](e: Expr[A]): Term protected def Expr[A](t: Term): Expr[A] - protected def hookRefToTerm(r: HookRef): Term + protected def refToTerm(r: Ref): Term protected def Type[A](t: TypeTree): Type[A] protected def typeOfTerm(t: Term): TypeTree + protected def wrap: (Vector[Stmt], Term) => Term protected val ApplyLike: ApplyExtractor protected abstract class ApplyExtractor { @@ -153,7 +162,7 @@ trait AbstractHookMacros { protected def showRaw(t: Term): String protected def showCode(t: Term): String - def rewriter(ctx: HookRewriterCtx[Stmt, Term]): Rewriter + protected val rewriterBridge: RewriterBridge protected def call(function: Term, args: List[Term]): Term protected def isUnit(t: TypeTree): Boolean @@ -173,24 +182,25 @@ trait AbstractHookMacros { protected object AutoTypeImplicits { @inline implicit def autoTerm[A](e: Expr[A]): Term = asTerm(e) - @inline implicit def autoHookRefToTerm(r: HookRef): Term = hookRefToTerm(r) - @inline implicit def autoHookRefToExpr[A](r: HookRef): Expr[A] = asTerm(hookRefToTerm(r)) + @inline implicit def autoRefToTerm(r: Ref): Term = refToTerm(r) + @inline implicit def autoRefToExpr[A](r: Ref): Expr[A] = asTerm(refToTerm(r)) @inline implicit def autoTypeOf[A](t: TypeTree): Type[A] = Type(t) @inline implicit def autoExprOf[A](t: Term): Expr[A] = Expr(t) } - type Rewriter = HookRewriterApi[Stmt, Term, HookRef] - type RewriterCtx = HookRewriterCtx[Stmt, Term] + type Rewriter = HookRewriter[Stmt, Term, Ref] + type RewriterBridge = HookRewriter.Bridge[Stmt, Term, Ref] + type RewriterCtx = HookRewriter.InitialCtx[Stmt, Term] def rewriterCtx(props: Term, initChildren: Stmt, children: Term): RewriterCtx = - HookRewriterCtx(props, initChildren, children) + HookRewriter.InitialCtx(props, initChildren, children) implicit val log: MacroLogger = MacroLogger() - case class HookDefn(steps: List[HookStep]) { + case class HookDefn(steps: Vector[HookStep]) { def +(s: HookStep): HookDefn = - HookDefn(steps ::: s :: Nil) + HookDefn(steps :+ s) } case class HookStep(name: String, targs: List[TypeTree], args: List[List[Term]]) { @@ -199,6 +209,19 @@ trait AbstractHookMacros { private val withHooks = "withHooks" + private def traverseVector[A, E, B](as: Vector[A])(f: A => Either[E, B]): Either[E, Vector[B]] = { + var results = Vector.empty[B] + var i = 0 + while (i < as.length) { + f(as(i)) match { + case Right(b) => results :+= b + case Left(e) => return Left(e) + } + i += 1 + } + Right(results) + } + final def parse(tree: Term): Either[() => String, HookDefn] = { log.hold() val r = _parse(tree, Nil, Nil, Nil) @@ -224,7 +247,7 @@ trait AbstractHookMacros { if (args.nonEmpty) Left(() => s"$withHooks called with args when none exepcted: ${args.map(_.map(showCode(_)))}") else - Right(HookDefn(steps)) + Right(HookDefn(steps.toVector)) } else { val step = HookStep(name, targs, args) log(s"Found step '$name'", step) @@ -235,52 +258,35 @@ trait AbstractHookMacros { Left(() => "Don't know how to parse " + showRaw(tree)) } - def applyRewrite(rewrite: Rewriter => Term): RewriterCtx => Expr[React.Node] = ctx => { - import AutoTypeImplicits._ - val b = rewriter(ctx) - val vdom = rewrite(b) - b.wrap(vdomRawNode(vdom)) - } + def rewriteComponent(h: HookDefn): Either[() => String, RewriterCtx => Expr[React.Node]] = { + if (h.steps.isEmpty) + return Left(() => "Failed to find any hook steps to parse.") - def rewriteComponent(h: HookDefn): Either[() => String, Rewriter => Term] = { - val it = h.steps.iterator - var renderStep = null : HookStep - var hookFns = Vector.empty[Rewriter => Option[HookRef]] - var withPropsChildren = false - while (it.hasNext) { - val step = it.next() - if (it.hasNext) { - if (hookFns.isEmpty && step.name == "withPropsChildren") - withPropsChildren = true - else - rewriteStep(step) match { - case Right(h) => hookFns :+= h - case Left(e) => return Left(e) - } - } else - renderStep = step - } + val withPropsChildren = h.steps.head.name == "withPropsChildren" + val hookSteps = if (withPropsChildren) h.steps.init.tail else h.steps.init + val renderStep = h.steps.last - rewriteRender(renderStep).map { buildRender => b => - if (withPropsChildren) - b.useChildren() - for (hf <- hookFns) - hf(b) match { - case Some(h) => b.registerHook(h) - case None => b.skipHook() - } - buildRender(b) + for { + hookFns <- traverseVector(hookSteps)(rewriteStep) + renderFn <- rewriteRender(renderStep) + } yield rctx => { + val r0 = HookRewriter.init(rctx, rewriterBridge, withPropsChildren) + val rH = hookFns.foldLeft(r0)((r, hf) => HookRewriter.next(r)(hf(r))) + val vdom = renderFn(rH) + + import AutoTypeImplicits._ + wrap(rH.stmts(), vdomRawNode(vdom)) } } - def rewriteStep(step: HookStep): Either[() => String, Rewriter => Option[HookRef]] = { + def rewriteStep(step: HookStep): Either[() => String, Rewriter => Option[Ref]] = { log("rewriteStep:" + step.name, step) def by[A](fn: Term)(use: (Rewriter, Term => Term) => A): Either[() => String, Rewriter => A] = fn match { case FunctionLike(paramCount) => Right { b => - val args = b.argsOrCreateCtxArg(paramCount) + val args = b.argsOrCtxArg(paramCount) use(b, call(_, args)) } @@ -294,7 +300,7 @@ trait AbstractHookMacros { else Right(use(_, identity)) - implicit def autoSomeHookRefs(r: HookRef): Option[HookRef] = + implicit def autoSomeRefs(r: Ref): Option[Ref] = Some(r) import AutoTypeImplicits._ @@ -311,10 +317,10 @@ trait AbstractHookMacros { if (isUnit(i)) custom[Unit, X](unitType, o, h, unitTerm) else { - val ctxArgs = b.argsOrCreateCtxArg(1) + val ctxArgs = b.argsOrCtxArg(1) val List(ctxArg) = ctxArgs : @nowarn val ctxArgType = typeOfTerm(ctxArg) - val ctx = b.valDef(customArg[X, X](ctxArgType, o, a, ctxArg), "_ctx") + val ctx = b.valDef(customArg[X, X](ctxArgType, o, a, ctxArg), "_arg") custom[X, X](i, o, h, ctx) } b.createHook(initHook, discard = isUnit(o)) @@ -324,8 +330,9 @@ trait AbstractHookMacros { val (List(o), List(List(h), List(_, _))) = step.sig : @nowarn by(h) { (b, withCtx) => b.createRawAndHook( - raw = withCtx(h), - hook = custom[Unit, X](unitType, o, _, unitTerm)) + raw = withCtx(h), + hook = custom[Unit, X](unitType, o, _, unitTerm), + discard = isUnit(o)) } // case "useMemo" | "useMemoBy" => @@ -354,13 +361,13 @@ trait AbstractHookMacros { } } - def rewriteRender(step: HookStep)(implicit log: MacroLogger): Either[() => String, Rewriter => Term] = { + def rewriteRender(step: HookStep): Either[() => String, Rewriter => Term] = { log("rewriteRender:" + step.name, step) step.name match { case "render" | "renderDebug" => val List(List(renderFn), _) = step.args : @nowarn - Right(b => call(renderFn, b.args())) + Right(b => call(renderFn, b.args)) case _ => Left(() => s"Inlining of render method '${step.name}' not yet supported.") diff --git a/library/tests/src/test/scala-2/japgolly/scalajs/react/core/ScalaSpecificHooksTest.scala b/library/tests/src/test/scala-2/japgolly/scalajs/react/core/ScalaSpecificHooksTest.scala index 8e9fbc3d2..f3cfcb55a 100644 --- a/library/tests/src/test/scala-2/japgolly/scalajs/react/core/ScalaSpecificHooksTest.scala +++ b/library/tests/src/test/scala-2/japgolly/scalajs/react/core/ScalaSpecificHooksTest.scala @@ -4,15 +4,16 @@ import japgolly.scalajs.react._ import japgolly.scalajs.react.test.TestUtil._ import japgolly.scalajs.react.vdom.html_<^._ -object ScalaSpecificHooksTest { +class ScalaSpecificHooksTest { import HooksTest._ + private val hookS = CustomHook[Int].useStateBy(identity).buildReturning(_.hook1) + // TODO: https://github.com/lampepfl/dotty/issues/12663 // This is the original version def testCustomHook(): Unit = { val counter = new Counter - val hookS = CustomHook[Int].useStateBy(identity).buildReturning(_.hook1) val hookE = CustomHook[Int].useEffectBy(counter.incCB(_)).build val comp = ScalaFnComponent.withHooks[PI] diff --git a/library/tests/src/test/scala-3/japgolly/scalajs/react/core/ScalaSpecificHooksTest.scala b/library/tests/src/test/scala-3/japgolly/scalajs/react/core/ScalaSpecificHooksTest.scala index 6ca6215d6..1e72da1b2 100644 --- a/library/tests/src/test/scala-3/japgolly/scalajs/react/core/ScalaSpecificHooksTest.scala +++ b/library/tests/src/test/scala-3/japgolly/scalajs/react/core/ScalaSpecificHooksTest.scala @@ -4,16 +4,17 @@ import japgolly.scalajs.react._ import japgolly.scalajs.react.test.TestUtil._ import japgolly.scalajs.react.vdom.html_<^._ -object ScalaSpecificHooksTest { +class ScalaSpecificHooksTest { import HooksTest._ + // TODO: These have been moved outside due to https://github.com/lampepfl/dotty/issues/15435 + private val counter = new Counter + private val hookS = CustomHook[Int].useStateBy(identity).buildReturning(_.hook1) + private val hookE = CustomHook[Int].useEffectBy(counter.incCB(_)).build + // TODO: https://github.com/lampepfl/dotty/issues/12663 // I swapped the order of the last two hooks to avoid use of a CtxFn after a DynamicNextStep. def testCustomHook(): Unit = { - val counter = new Counter - - val hookS = CustomHook[Int].useStateBy(identity).buildReturning(_.hook1) - val hookE = CustomHook[Int].useEffectBy(counter.incCB(_)).build val comp = ScalaFnComponent.withHooks[PI] .custom(hookE(10)) @@ -22,7 +23,7 @@ object ScalaSpecificHooksTest { .customBy((p, s, _) => hookE(p.pi + s.value)) .customBy($ => hookE($.props.pi + $.hook1.value + 1)) .customBy($ => hookS($.props.pi + $.hook1.value + 1)) // <--- s3 - .render((_, s1, s2, s3) => + .renderDebug((_, s1, s2, s3) => <.div( s"${s1.value}:${s2.value}:${s3.value}", <.button(^.onClick --> s1.modState(_ + 1)) diff --git a/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksTest.scala b/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksTest.scala index 407954639..31d9cafcc 100644 --- a/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksTest.scala +++ b/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksTest.scala @@ -112,7 +112,7 @@ object HooksTest extends TestSuite { private def testCustomHook(): Unit = { // TODO: https://github.com/lampepfl/dotty/issues/12663 - ScalaSpecificHooksTest.testCustomHook() + (new ScalaSpecificHooksTest).testCustomHook() // val counter = new Counter @@ -144,7 +144,11 @@ object HooksTest extends TestSuite { } private def testCustomHookComposition(): Unit = { + new TestCustomHookComposition + } + // TODO: Temporary workaround to https://github.com/lampepfl/dotty/issues/15435 + private class TestCustomHookComposition { locally { type LL = CustomHook[Long, Long] type II = CustomHook[Int, Int] From b28aac6284b1a82a808dfa0deb540edbfe9e58ab Mon Sep 17 00:00:00 2001 From: David Barri Date: Tue, 14 Jun 2022 15:40:44 +1000 Subject: [PATCH 39/72] Refactor and improve readability of new hook macro code --- .../scalajs/react/hooks/HookMacros.scala | 105 ++++++++---------- .../scalajs/react/hooks/HookMacros.scala | 87 +++++++-------- .../react/hooks/AbstractHookMacros.scala | 85 +++++++------- 3 files changed, 129 insertions(+), 148 deletions(-) diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala index e9fe98fc4..789f293a7 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -30,11 +30,53 @@ class HookMacros(val c: Context) extends MacroUtils { override type Type[A] = c.universe.Type override type TypeTree = c.universe.TypeTree - override protected def asTerm[A](e: Expr[A]) = e - override protected def Expr[A](t: Term) = t - override protected def refToTerm(r: Ref) = Ident(r) - override protected def Type[A](t: TypeTree) = t.tpe - override protected def typeOfTerm(t: Term) = c.universe.TypeTree(t.tpe) + override protected def asTerm [A](e: Expr[A]) = e + override protected def Expr [A](t: Term) = t + override protected def isUnit (t: TypeTree) = t.tpe == typeOf[Unit] + override protected def refToTerm (r: Ref) = Ident(r) + override protected def showCode (t: Term) = c.universe.showCode(t) + override protected def showRaw (t: Term) = c.universe.showRaw(t) + override protected def Type [A](t: TypeTree) = t.tpe + override protected def typeOfTerm (t: Term) = c.universe.TypeTree(t.tpe) + override protected def unitTerm = q"()" + override protected def unitType = c.universe.definitions.UnitTpe + override protected def wrap = (s, b) => q"..$s; $b" + + override def call(function: Tree, args: List[Tree]): Tree = { + import internal._ + function match { + case Function(params, body) => + + // From scala/test/files/run/macro-range/Common_1.scala + class TreeSubstituter(from: List[Symbol], to: List[Tree]) extends Transformer { + override def transform(tree: Tree): Tree = tree match { + case Ident(_) => + def subst(from: List[Symbol], to: List[Tree]): Tree = + if (from.isEmpty) tree + else if (tree.symbol == from.head) to.head.duplicate + else subst(from.tail, to.tail); + subst(from, to) + case _ => + val tree1 = super.transform(tree) + if (tree1 ne tree) setType(tree1, null) + tree1 + } + } + val t = new TreeSubstituter(params.map(_.symbol), args) + t.transform(body) + + case _ => + Apply(Select(function, TermName("apply")), args) + } + } + + override protected val rewriterBridge: RewriterBridge = + HookRewriter.Bridge[Stmt, Term, Ref]( + apply = Apply(_, _), + hookCtx = (c, as) => Apply(if (c) q"$HookCtx.withChildren" else HookCtx, as), + refToTerm = r => Ident(r), + valDef = (n, t) => { val r = TermName(n); (q"val $r = $t", r) }, + ) override val ApplyLike = new ApplyExtractor { override def unapply(a: Term) = a match { @@ -77,57 +119,6 @@ class HookMacros(val c: Context) extends MacroUtils { } } - override def showRaw(t: Term): String = c.universe.showRaw(t) - override def showCode(t: Term): String = c.universe.showCode(t) - - override protected def wrap = - (s, b) => q"..$s; $b" - - override protected val rewriterBridge: RewriterBridge = - HookRewriter.Bridge[Stmt, Term, Ref]( - apply = Apply(_, _), - hookCtx = (c, as) => Apply(if (c) q"$HookCtx.withChildren" else HookCtx, as), - refToTerm = r => Ident(r), - valDef = (n, t) => { val r = TermName(n); (q"val $r = $t", r) }, - ) - - override def call(function: Tree, args: List[Tree]): Tree = { - import internal._ - function match { - case Function(params, body) => - - // From scala/test/files/run/macro-range/Common_1.scala - class TreeSubstituter(from: List[Symbol], to: List[Tree]) extends Transformer { - override def transform(tree: Tree): Tree = tree match { - case Ident(_) => - def subst(from: List[Symbol], to: List[Tree]): Tree = - if (from.isEmpty) tree - else if (tree.symbol == from.head) to.head.duplicate - else subst(from.tail, to.tail); - subst(from, to) - case _ => - val tree1 = super.transform(tree) - if (tree1 ne tree) setType(tree1, null) - tree1 - } - } - val t = new TreeSubstituter(params.map(_.symbol), args) - t.transform(body) - - case _ => - Apply(Select(function, TermName("apply")), args) - } - } - - override protected def isUnit(t: TypeTree): Boolean = - t.tpe == typeOf[Unit] - - override protected def unitTerm = - q"()" - - override protected def unitType = - c.universe.definitions.UnitTpe - override protected def custom[I, O] = (_, _, hook, i) => q"$hook.unsafeInit($i)" @@ -164,8 +155,8 @@ class HookMacros(val c: Context) extends MacroUtils { (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = { val hookMacros = new HookMacrosImpl - import hookMacros.log + import hookMacros.log log.enabled = debug log.header() diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala index c33fe0d11..8dbdba25a 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala @@ -37,18 +37,41 @@ object HookMacros { override type Type[A] = scala.quoted.Type[A] override type TypeTree = q.reflect.TypeTree - override protected def asTerm[A](e: Expr[A]) = e.asTerm - override protected def Expr[A](t: Term) = t.asExprOf[Any].asInstanceOf[Expr[A]] - override protected def refToTerm(r: Ref) = r.ref - override protected def typeOfTerm(t: Term) = t.tpe.asTypeTree + override protected def asTerm [A](e: Expr[A]) = e.asTerm + override protected def Expr [A](t: Term) = t.asExprOf[Any].asInstanceOf[Expr[A]] + override protected def refToTerm (r: Ref) = r.ref + override protected def showCode (t: Term) = t.show(using q.reflect.Printer.TreeShortCode) + override protected def showRaw (t: Term) = t.show(using q.reflect.Printer.TreeStructure) + override protected def typeOfTerm (t: Term) = t.tpe.asTypeTree + override protected def unitTerm = '{ () } + override protected def unitType = scala.quoted.Type.of[Unit] + override protected def wrap = (s, b) => Block(s.toList, b) + + override def call(function: Term, args: List[Term]): Term = { + val f = extractFunction(function) + val t = Apply(Select.unique(f, "apply"), args) + Term.betaReduce(t).getOrElse(t) + } + + @tailrec + private def extractFunction(term: Term): Term = + term match { + case Inlined(None, Nil, f) => extractFunction(f) + case Block(Nil, expr) => extractFunction(expr) + case f => f + } + + override protected def isUnit(t: TypeTree): Boolean = + t.tpe.asType match { + case '[Unit] => true + case _ => false + } + override protected def Type[A](t: TypeTree) = { val x: scala.quoted.Type[?] = t.asType x.asInstanceOf[scala.quoted.Type[A]] } - override protected def wrap = - (s, b) => Block(s.toList, b) - override protected val rewriterBridge: RewriterBridge = HookRewriter.Bridge[Stmt, Term, Ref]( apply = Apply(_, _), @@ -60,21 +83,21 @@ object HookMacros { override val ApplyLike = new ApplyExtractor { override def unapply(a: Term) = a match { case Apply(x, y) => Some((x, y)) - case _ => None + case _ => None } } override val TypeApplyLike = new TypeApplyExtractor { override def unapply(a: Term) = a match { case TypeApply(x, y) => Some((x, y)) - case _ => None + case _ => None } } override val SelectLike = new SelectExtractor { override def unapply(a: Term) = a match { case Select(x, y) => Some((x, y)) - case _ => None + case _ => None } } @@ -89,8 +112,8 @@ object HookMacros { case i@ Ident(_) => i.symbol.tree match { - case d: DefDef => byTypeTree(d.returnTpt) - case v: ValDef => byTypeTree(v.tpt) + case d: DefDef => byTypeRepr(d.returnTpt.tpe) + case v: ValDef => byTypeRepr(v.tpt.tpe) case _ => None } @@ -98,9 +121,6 @@ object HookMacros { None } - private def byTypeTree(tpt: TypeTree): Option[Success] = - byTypeRepr(tpt.tpe) - private def byTypeRepr(t: TypeRepr): Option[Success] = t match { case AppliedType(TypeRef(ThisType(_), f), args) if f.startsWith("Function") => Some(args.size - 1) @@ -109,35 +129,6 @@ object HookMacros { } } - override def showRaw(t: Term): String = t.show(using q.reflect.Printer.TreeStructure) - override def showCode(t: Term): String = t.show(using q.reflect.Printer.TreeShortCode) - - @tailrec - private def extractFunction(term: Term): Term = - term match { - case Inlined(None, Nil, f) => extractFunction(f) - case Block(Nil, expr) => extractFunction(expr) - case f => f - } - - override def call(function: Term, args: List[Term]): Term = { - val f = extractFunction(function) - val t = Apply(Select.unique(f, "apply"), args) - Term.betaReduce(t).getOrElse(t) - } - - override protected def isUnit(t: TypeTree): Boolean = - t.tpe.asType match { - case '[Unit] => true - case _ => false - } - - override protected def unitTerm = - '{ () } - - override protected def unitType: Type[Unit] = - scala.quoted.Type.of[Unit] - override protected def custom[I, O] = implicit (ti, to, hook, i) => '{ $hook.unsafeInit($i) } @@ -218,13 +209,13 @@ object HookMacros { val rewriteAttempt = for { hookDefn <- hookMacros.parse(self.asTerm.underlying) - compBody <- hookMacros.rewriteComponent(hookDefn + renderStep) - } yield compBody + rewriter <- hookMacros.rewriteComponent(hookDefn + renderStep) + } yield rewriter val result: Expr[Component[P, CT]] = rewriteAttempt match { - case Right(rewrite) => + case Right(rewriter) => type JsProps = Box[P] with facade.PropsWithChildren def newBody(props: Expr[JsProps]): Expr[React.Node] = { @@ -234,7 +225,7 @@ object HookMacros { initChildren = children.valDef, children = children.ref.asTerm, ) - rewrite(ctx) + rewriter(ctx) } '{ diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala index 4f84b6a8e..cc100accd 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala @@ -16,13 +16,14 @@ object AbstractHookMacros { val bridge : HookRewriter.Bridge[Stmt, Term, Ref] protected val hookNo : Int protected val initialCtx : HookRewriter.InitialCtx[Stmt, Term] + protected def initialStmts: Vector[Stmt] protected val prevHooks : List[Term] protected val usesChildren: Boolean - protected def initialStmts: Vector[Stmt] private var _stmts: Vector[Stmt] = initialStmts + // Don't make this an eager val. It depends on `val hookNo` protected def hookName = "hook" + hookNo @@ -100,9 +101,9 @@ object AbstractHookMacros { override val bridge = bridg override protected val hookNo = 1 override protected val initialCtx = ctx + override protected def initialStmts = if (useChildren) Vector(ctx.initChildren) else Vector.empty override protected val prevHooks = Nil override protected val usesChildren = useChildren - override protected def initialStmts = if (useChildren) Vector(ctx.initChildren) else Vector.empty } def next[Stmt, Term <: Stmt, Ref](prev: HookRewriter[Stmt, Term, Ref])(newHook: Option[Ref]): HookRewriter[Stmt, Term, Ref] = @@ -110,9 +111,9 @@ object AbstractHookMacros { override val bridge = prev.bridge override protected val hookNo = prev.hookNo + 1 override protected val initialCtx = prev.initialCtx + override protected def initialStmts = prev.stmts() override protected val prevHooks = newHook.fold(prev.prevHooks)(prev.prevHooks :+ prev.bridge.refToTerm(_)) override protected val usesChildren = prev.usesChildren - override protected def initialStmts = prev.stmts() } } } @@ -122,8 +123,6 @@ object AbstractHookMacros { trait AbstractHookMacros { import AbstractHookMacros._ - // Abstractions - type Expr[A] type Ref type Stmt @@ -131,13 +130,6 @@ trait AbstractHookMacros { type Type[A] type TypeTree - protected def asTerm[A](e: Expr[A]): Term - protected def Expr[A](t: Term): Expr[A] - protected def refToTerm(r: Ref): Term - protected def Type[A](t: TypeTree): Type[A] - protected def typeOfTerm(t: Term): TypeTree - protected def wrap: (Vector[Stmt], Term) => Term - protected val ApplyLike: ApplyExtractor protected abstract class ApplyExtractor { def unapply(apply: Term): Option[(Term, List[Term])] @@ -159,45 +151,30 @@ trait AbstractHookMacros { def unapply(function: Term): Option[Success] } - protected def showRaw(t: Term): String - protected def showCode(t: Term): String - - protected val rewriterBridge: RewriterBridge - - protected def call(function: Term, args: List[Term]): Term - protected def isUnit(t: TypeTree): Boolean - protected def unitTerm: Expr[Unit] - protected def unitType: Type[Unit] + protected def asTerm [A](e: Expr[A]) : Term + protected def call (function: Term, args: List[Term]): Term + protected def Expr [A](t: Term) : Expr[A] + protected def isUnit (t: TypeTree) : Boolean + protected def refToTerm (r: Ref) : Term + protected def showCode (t: Term) : String + protected def showRaw (t: Term) : String + protected def Type [A](t: TypeTree) : Type[A] + protected def typeOfTerm (t: Term) : TypeTree + protected def unitTerm : Expr[Unit] + protected def unitType : Type[Unit] + protected def wrap : (Vector[Stmt], Term) => Term + protected val rewriterBridge : RewriterBridge protected def custom[I, O]: (Type[I], Type[O], Expr[CustomHook[I, O]], Expr[I]) => Expr[O] - protected def customArg[Ctx, Arg]: (Type[Ctx], Type[Arg], Expr[CustomHook.Arg[Ctx, Arg]], Expr[Ctx]) => Expr[Arg] - + protected def customArg[C, A]: (Type[C], Type[A], Expr[CustomHook.Arg[C, A]], Expr[C]) => Expr[A] protected def useStateFn[S]: (Type[S], Expr[S]) => Expr[React.UseState[Box[S]]] protected def useStateFromJsBoxed[S]: (Type[S], Expr[React.UseState[Box[S]]]) => Expr[Hooks.UseState[S]] protected def useStateWithReuseFromJsBoxed[S]: (Type[S], Expr[React.UseState[Box[S]]], Expr[Reusability[S]], Expr[ClassTag[S]]) => Expr[Hooks.UseStateWithReuse[S]] protected def vdomRawNode: Expr[VdomNode] => Expr[React.Node] - // ----------------------------------------------------------------------------------------------------------- + // ------------------------------------------------------------------------------------------------------------------- // Concrete - protected object AutoTypeImplicits { - @inline implicit def autoTerm[A](e: Expr[A]): Term = asTerm(e) - @inline implicit def autoRefToTerm(r: Ref): Term = refToTerm(r) - @inline implicit def autoRefToExpr[A](r: Ref): Expr[A] = asTerm(refToTerm(r)) - @inline implicit def autoTypeOf[A](t: TypeTree): Type[A] = Type(t) - @inline implicit def autoExprOf[A](t: Term): Expr[A] = Expr(t) - } - - type Rewriter = HookRewriter[Stmt, Term, Ref] - type RewriterBridge = HookRewriter.Bridge[Stmt, Term, Ref] - type RewriterCtx = HookRewriter.InitialCtx[Stmt, Term] - - def rewriterCtx(props: Term, initChildren: Stmt, children: Term): RewriterCtx = - HookRewriter.InitialCtx(props, initChildren, children) - - implicit val log: MacroLogger = - MacroLogger() - case class HookDefn(steps: Vector[HookStep]) { def +(s: HookStep): HookDefn = HookDefn(steps :+ s) @@ -207,7 +184,23 @@ trait AbstractHookMacros { def sig = (targs, args) } - private val withHooks = "withHooks" + final type Rewriter = HookRewriter[Stmt, Term, Ref] + final type RewriterBridge = HookRewriter.Bridge[Stmt, Term, Ref] + final type RewriterCtx = HookRewriter.InitialCtx[Stmt, Term] + + final implicit val log: MacroLogger = + MacroLogger() + + final def rewriterCtx(props: Term, initChildren: Stmt, children: Term): RewriterCtx = + HookRewriter.InitialCtx(props, initChildren, children) + + protected object AutoTypeImplicits { + @inline implicit def autoTerm[A](e: Expr[A]): Term = asTerm(e) + @inline implicit def autoRefToTerm(r: Ref): Term = refToTerm(r) + @inline implicit def autoRefToExpr[A](r: Ref): Expr[A] = asTerm(refToTerm(r)) + @inline implicit def autoTypeOf[A](t: TypeTree): Type[A] = Type(t) + @inline implicit def autoExprOf[A](t: Term): Expr[A] = Expr(t) + } private def traverseVector[A, E, B](as: Vector[A])(f: A => Either[E, B]): Either[E, Vector[B]] = { var results = Vector.empty[B] @@ -222,6 +215,7 @@ trait AbstractHookMacros { Right(results) } + // ------------------------------------------------------------------------------------------------------------------- final def parse(tree: Term): Either[() => String, HookDefn] = { log.hold() val r = _parse(tree, Nil, Nil, Nil) @@ -229,6 +223,8 @@ trait AbstractHookMacros { r } + private val withHooks = "withHooks" + @tailrec private def _parse(tree: Term, targs: List[TypeTree], args: List[List[Term]], steps: List[HookStep]): Either[() => String, HookDefn] = tree match { @@ -258,6 +254,7 @@ trait AbstractHookMacros { Left(() => "Don't know how to parse " + showRaw(tree)) } + // ------------------------------------------------------------------------------------------------------------------- def rewriteComponent(h: HookDefn): Either[() => String, RewriterCtx => Expr[React.Node]] = { if (h.steps.isEmpty) return Left(() => "Failed to find any hook steps to parse.") @@ -279,6 +276,7 @@ trait AbstractHookMacros { } } + // ------------------------------------------------------------------------------------------------------------------- def rewriteStep(step: HookStep): Either[() => String, Rewriter => Option[Ref]] = { log("rewriteStep:" + step.name, step) @@ -361,6 +359,7 @@ trait AbstractHookMacros { } } + // ------------------------------------------------------------------------------------------------------------------- def rewriteRender(step: HookStep): Either[() => String, Rewriter => Term] = { log("rewriteRender:" + step.name, step) step.name match { From 725a7fddc1ecfb494b7b8a4650970a5a24f79fe5 Mon Sep 17 00:00:00 2001 From: David Barri Date: Tue, 14 Jun 2022 16:03:40 +1000 Subject: [PATCH 40/72] Improve ReactRefreshTest * more informative per-test output * easier to support tests with RR isn't expected --- .../test/emissions/ReactRefreshTest.scala | 41 +++++++++++-------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala index 1bac5d13b..85643453e 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala @@ -1,5 +1,6 @@ package japgolly.scalajs.react.test.emissions +import java.lang.{Boolean => JBoolean} import japgolly.microlibs.testutil.TestUtil._ import japgolly.microlibs.utils.FileUtils import japgolly.scalajs.react.test.emissions.util._ @@ -84,14 +85,16 @@ object ReactRefreshTest extends TestSuite { Util.debugShowContent(s"$inFilename ", babel.after, "\u001b[106;30m") () } else - babel.assertOrSaveOutput(expectFilename) + babel.assertOrSaveOutput(expectFilename) match { + case () => testOutputFromSig(babel.after, null) + case r => r + } } /** Load scalajs-react output JS, run ReactRefresh transforms over it, and confirm the result. */ @nowarn("cat=unused") - protected def showScala(assertRR : Boolean = false, - assertNoRR : Boolean = false, - assertBabelChanges: Boolean = false, + protected def showScala(assertRR : JBoolean = null, + assertBabelChanges: JBoolean = null, showPreBabel : Boolean = false, showResult : Boolean = true, showDiff : Boolean = true, @@ -102,9 +105,8 @@ object ReactRefreshTest extends TestSuite { expectedFrags : Seq[String] = Seq.empty) (implicit tp : TestPath) = testScala( - assertRR = false, - assertNoRR = false, - assertBabelChanges = false, + assertRR = null, + assertBabelChanges = null, showPreBabel = showPreBabel, showResult = showResult, showDiff = showDiff, @@ -116,9 +118,8 @@ object ReactRefreshTest extends TestSuite { ) /** Load scalajs-react output JS, run ReactRefresh transforms over it, and confirm the result. */ - protected def testScala(assertRR : Boolean = true, - assertNoRR : Boolean = false, - assertBabelChanges: Boolean = true, + protected def testScala(assertRR : JBoolean = true, + assertBabelChanges: JBoolean = null, showPreBabel : Boolean = false, showResult : Boolean = false, showDiff : Boolean = false, @@ -159,13 +160,13 @@ object ReactRefreshTest extends TestSuite { } try { - if (assertBabelChanges) + if (assertBabelChanges || (assertBabelChanges == null && assertRR)) babel.assertChanged() if (assertRR) babel.assertRR(true) - if (assertNoRR) + if (assertRR == false) babel.assertRR(false) babel.assertOutputContains(expectedFrags: _*) @@ -174,12 +175,7 @@ object ReactRefreshTest extends TestSuite { utestOutput = babel.assertOrSaveOutput(expectFilename, onCmp) if (utestOutput == ()) - reactRefreshSignature(babel.after) match { - case Some(sig) => utestOutput = sig - case None => - if (assertRR) - utestOutput = "Failed to find the RefreshSig state id" - } + utestOutput = testOutputFromSig(babel.after, assertRR) } finally { def show(s: String): String = onShow.runAs(name, s).content @@ -203,4 +199,13 @@ object ReactRefreshTest extends TestSuite { case rrSigHashRegex(h) => Some(h) case _ => None } + + private def testOutputFromSig(js: String, expect: JBoolean): Any = + if (expect == false) + "react-refresh not installed" + else + reactRefreshSignature(js) match { + case Some(sig) => sig + case None => if (expect) "Failed to find the RefreshSig state id" else () + } } From 1128fc4dd0f9ab680b90319290b8ce9e74a3411b Mon Sep 17 00:00:00 2001 From: David Barri Date: Tue, 14 Jun 2022 16:09:58 +1000 Subject: [PATCH 41/72] Add emission tests for custom hooks --- library/TODO.md | 25 +-- .../react/test/emissions/CustomHooks.scala | 20 +++ .../react/test/emissions/CustomHooksBy.scala | 20 +++ .../scalajs/react/test/emissions/Main.scala | 2 + .../test/resources/rr-sjr/CustomHooks-out2.js | 110 ++++++++++++ .../test/resources/rr-sjr/CustomHooks-out3.js | 147 ++++++++++++++++ .../resources/rr-sjr/CustomHooksBy-out2.js | 119 +++++++++++++ .../resources/rr-sjr/CustomHooksBy-out3.js | 166 ++++++++++++++++++ .../test/emissions/ReactRefreshTest.scala | 2 + .../react/test/emissions/util/TestJs.scala | 4 +- 10 files changed, 597 insertions(+), 18 deletions(-) create mode 100644 library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/CustomHooks.scala create mode 100644 library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/CustomHooksBy.scala create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out2.js create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out3.js create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out2.js create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out3.js diff --git a/library/TODO.md b/library/TODO.md index 328075931..88dc8776d 100644 --- a/library/TODO.md +++ b/library/TODO.md @@ -1,13 +1,10 @@ ```scala // HookComponentBuilder.scala -/* [--] */ def withPropsChildren: ComponentPC.First[P] +/* [23] */ def withPropsChildren: ComponentPC.First[P] /* [--] */ def render(f: (P, PropsChildren) => VdomNode)(implicit s: CtorType.Summoner[Box[P], Children.Varargs]): Component[P, s.CT] /* [--] */ def render in primary API // Api.scala -/* [--] */ def custom [I, O](hook: CustomHook[I, O])(implicit step: Step, a: CustomHook.Arg[Ctx, I], d: DynamicNextStep[O]): d.OneOf[step.Self, step.Next[O]] -/* [--] */ def customBy [O](hook: Ctx => CustomHook[Unit, O])(implicit step: Step, d: DynamicNextStep[O]): d.OneOf[step.Self, step.Next[O]] -/* [--] */ def customBy [O](hook: CtxFn[CustomHook[Unit, O]])(implicit step: Step, d: DynamicNextStep[O]): d.OneOf[step.Self, step.Next[O]] /* [--] */ def localLazyVal [A](a: => A)(implicit step: Step): step.Next[() => A] /* [--] */ def localLazyValBy [A](f: Ctx => A)(implicit step: Step): step.Next[() => A] /* [--] */ def localLazyValBy [A](f: CtxFn[A])(implicit step: Step): step.Next[() => A] @@ -17,13 +14,6 @@ /* [--] */ def localVar [A](a: => A)(implicit step: Step): step.Next[Var[A]] /* [--] */ def localVarBy [A](f: Ctx => A)(implicit step: Step): step.Next[Var[A]] /* [--] */ def localVarBy [A](f: CtxFn[A])(implicit step: Step): step.Next[Var[A]] -/* [2-] */ def render (f: Ctx => VdomNode)(implicit s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] -/* [--] */ def renderReusable [A](f: Ctx => Reusable[A])(implicit s: CtorType.Summoner[Box[P], C], v: A => VdomNode): Component[P, s.CT] -/* [--] */ def renderReusable [A](f: CtxFn[Reusable[A]])(implicit step: Step, s: CtorType.Summoner[Box[P], C], v: A => VdomNode): Component[P, s.CT] -/* [--] */ def renderWithReuse (f: Ctx => VdomNode)(implicit s: CtorType.Summoner[Box[P], C], r: Reusability[Ctx]): Component[P, s.CT] -/* [--] */ def renderWithReuse (f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C], r: Reusability[Ctx]): Component[P, s.CT] -/* [--] */ def renderWithReuseBy [A](reusableInputs: Ctx => A)(f: A => VdomNode)(implicit s: CtorType.Summoner[Box[P], C], r: Reusability[A]): Component[P, s.CT] -/* [--] */ def renderWithReuseBy [A](reusableInputs: CtxFn[A])(f: A => VdomNode)(implicit step: Step, s: CtorType.Summoner[Box[P], C], r: Reusability[A]): Component[P, s.CT] /* [--] */ def unchecked [A](f: => A)(implicit step: Step, d: DynamicNextStep[A]): d.OneOf[step.Self, step.Next[A]] /* [--] */ def uncheckedBy [A](f: Ctx => A)(implicit step: Step, d: DynamicNextStep[A]): d.OneOf[step.Self, step.Next[A]] /* [--] */ def uncheckedBy [A](f: CtxFn[A])(implicit step: Step, d: DynamicNextStep[A]): d.OneOf[step.Self, step.Next[A]] @@ -74,10 +64,11 @@ /* [--] */ def useRefToScalaComponent [P, S, B, CT[-p, +u] <: CtorType[p, u /* [--] */ def useRefToScalaComponent [P, S, B](implicit step: Step): step.Next[Ref.ToScalaComponent[P, S, B]] /* [--] */ def useRefToVdom [N <: TopNode: ClassTag](implicit step: Step): step.Next[Ref.ToVdom[N]] -/* [2-] */ def useState [S](initialState: => S)(implicit step: Step): step.Next[UseState[S]] -/* [2-] */ def useStateBy [S](initialState: Ctx => S)(implicit step: Step): step.Next[UseState[S]] -/* [2-] */ def useStateBy [S](initialState: CtxFn[S])(implicit step: Step): step.Next[UseState[S]] -/* [2-] */ def useStateWithReuse [S: ClassTag: Reusability](initialState: => S)(implicit step: Step): step.Next[UseStateWithReuse[S]] -/* [2-] */ def useStateWithReuseBy [S: ClassTag: Reusability](initialState: Ctx => S)(implicit step: Step): step.Next[UseStateWithReuse[S]] -/* [2-] */ def useStateWithReuseBy [S: ClassTag: Reusability](initialState: CtxFn[S])(implicit step: Step): step.Next[UseStateWithReuse[S]] + +/* [--] */ def renderReusable [A](f: Ctx => Reusable[A])(implicit s: CtorType.Summoner[Box[P], C], v: A => VdomNode): Component[P, s.CT] +/* [--] */ def renderReusable [A](f: CtxFn[Reusable[A]])(implicit step: Step, s: CtorType.Summoner[Box[P], C], v: A => VdomNode): Component[P, s.CT] +/* [--] */ def renderWithReuse (f: Ctx => VdomNode)(implicit s: CtorType.Summoner[Box[P], C], r: Reusability[Ctx]): Component[P, s.CT] +/* [--] */ def renderWithReuse (f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C], r: Reusability[Ctx]): Component[P, s.CT] +/* [--] */ def renderWithReuseBy [A](reusableInputs: Ctx => A)(f: A => VdomNode)(implicit s: CtorType.Summoner[Box[P], C], r: Reusability[A]): Component[P, s.CT] +/* [--] */ def renderWithReuseBy [A](reusableInputs: CtxFn[A])(f: A => VdomNode)(implicit step: Step, s: CtorType.Summoner[Box[P], C], r: Reusability[A]): Component[P, s.CT] ``` diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/CustomHooks.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/CustomHooks.scala new file mode 100644 index 000000000..6a8edf833 --- /dev/null +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/CustomHooks.scala @@ -0,0 +1,20 @@ +package japgolly.scalajs.react.test.emissions + +import japgolly.scalajs.react._ +import japgolly.scalajs.react.vdom.html_<^._ + +object CustomHooks { + + val customHook1 = CustomHook[Int].useStateBy(_ + 1).buildReturning(_.hook1) + val customHook2 = CustomHook[Unit].useEffect(Callback.log("hello")).build + val customHook3 = CustomHook[Unit].useState(123).buildReturning(_.hook1) + + val Component = ScalaFnComponent.withHooks[Int] + .custom(customHook1) + .custom(customHook2) + .custom(customHook3) + .render { (p, s1, s2) => + val sum = p + s1.value + s2.value + <.div("Sum = ", sum) + } +} diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/CustomHooksBy.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/CustomHooksBy.scala new file mode 100644 index 000000000..511c5de41 --- /dev/null +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/CustomHooksBy.scala @@ -0,0 +1,20 @@ +package japgolly.scalajs.react.test.emissions + +import japgolly.scalajs.react._ +import japgolly.scalajs.react.vdom.html_<^._ + +object CustomHooksBy { + + val customHook1 = CustomHook[Int].useStateBy(_ + 1).buildReturning(_.hook1) + val customHook2 = CustomHook[Int].useStateBy(_ * 2).buildReturning(_.hook1) + val customHook3 = CustomHook[Int].useStateBy(_ * 3).buildReturning(_.hook1) + + val Component = ScalaFnComponent.withHooks[Int] + .customBy(p => customHook1(p - 1)) + .customBy((_, s1) => customHook2(s1.value)) + .customBy($ => customHook3($.hook2.value)) + .render { (p, s1, s2, s3) => + val sum = p + s1.value + s2.value + s3.value + <.div("Sum = ", sum) + } +} diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala index 278fc802b..5722863bd 100644 --- a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala @@ -14,6 +14,8 @@ object Main { private val Component = ScalaFnComponent[Unit] { _ => <.div( + CustomHooks.Component(0), + CustomHooksBy.Component(0), HooksWithChildren.Component(0)(<.div), HooksWithJsFns.Component(0), HooksWithScalaFns.Component(0), diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out2.js new file mode 100644 index 000000000..455654813 --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out2.js @@ -0,0 +1,110 @@ +'use strict'; + +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary from "./japgolly.scalajs.react.hooks.Api$Primary.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Arg$0024 from "./japgolly.scalajs.react.hooks.CustomHook$Arg$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First from "./japgolly.scalajs.react.hooks.CustomHook$Builder$First.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024Subsequent from "./japgolly.scalajs.react.hooks.CustomHook$Builder$Subsequent.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024I1 from "./japgolly.scalajs.react.hooks.HookCtx$I1.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseEffectArg$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF from "./japgolly.scalajs.react.hooks.Hooks$UseStateF.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 from "./japgolly.scalajs.react.internal.Singleton$.js"; +import * as $j_japgolly$002escalajs$002ereact$002epackage$0024 from "./japgolly.scalajs.react.package$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024 from "./japgolly.scalajs.react.util.EffectCallback$callback$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement from "./japgolly.scalajs.react.vdom.VdomElement.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002eFunction1 from "./scala.Function1.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; +import * as $j_scala$002escalajs$002eruntime$002eWrappedVarArgs from "./scala.scalajs.runtime.WrappedVarArgs.js"; + +function $c_Ljapgolly_scalajs_react_test_emissions_CustomHooks$() { + this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook1 = null; + this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook2 = null; + this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook3 = null; + this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_Component = null; + $n_Ljapgolly_scalajs_react_test_emissions_CustomHooks$ = this; + var this$3 = $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_CustomHook.apply__Ljapgolly_scalajs_react_hooks_CustomHook$Builder$First(); + var initialState = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$1$2 => { + var x$1 = x$1$2 | 0; + return 1 + x$1 | 0; + }); + var step = new $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First.$c_Ljapgolly_scalajs_react_hooks_CustomHook$Builder$FirstStep(); + this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useStateBy__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$3, initialState, step).buildReturning__F1__F1(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$2$2 => { + var x$2 = x$2$2; + return x$2.Ljapgolly_scalajs_react_hooks_HookCtx$I1__f_hook1; + })); + var this$6 = $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_CustomHook.apply__Ljapgolly_scalajs_react_hooks_CustomHook$Builder$First(); + var effect = new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline("hello", $j_java$002elang$002eCharacter$0024.$m_sci_Nil$())); + var a = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); + var step$1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First.$c_Ljapgolly_scalajs_react_hooks_CustomHook$Builder$FirstStep(); + this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useEffect__O__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$6, effect, a, step$1).build__F1(); + var this$8 = $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_CustomHook.apply__Ljapgolly_scalajs_react_hooks_CustomHook$Builder$First(); + var initialState$1 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => 123); + var step$2 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First.$c_Ljapgolly_scalajs_react_hooks_CustomHook$Builder$FirstStep(); + this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useState__F0__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$8, initialState$1, step$2).buildReturning__F1__F1(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$3$2 => { + var x$3 = x$3$2; + return x$3.Ljapgolly_scalajs_react_hooks_HookCtx$I1__f_hook1; + })); + + var rawComponent = arg1$2 => $m_Ljapgolly_scalajs_react_test_emissions_CustomHooks$().japgolly$scalajs$react$test$emissions$CustomHooks$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2); + + var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$9 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$(), null)); + this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$9.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_CustomHooks$ }; +$c_Ljapgolly_scalajs_react_test_emissions_CustomHooks$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_CustomHooks$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_CustomHooks$; + +function $h_Ljapgolly_scalajs_react_test_emissions_CustomHooks$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_CustomHooks$ }; +$h_Ljapgolly_scalajs_react_test_emissions_CustomHooks$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_CustomHooks$.prototype; + +$c_Ljapgolly_scalajs_react_test_emissions_CustomHooks$.prototype.japgolly$scalajs$react$test$emissions$CustomHooks$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = function (props) { + var this$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Arg$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$Arg$().exactId__F1(); + var v1 = props.a | 0; + var hook1_arg = this$1.apply__O__O(v1) | 0; + var hook1 = $m_Ljapgolly_scalajs_react_test_emissions_CustomHooks$().Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook1.apply__O__O(hook1_arg); + $m_Ljapgolly_scalajs_react_test_emissions_CustomHooks$().Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook2.apply__O__O(void 0); + var hook3 = $m_Ljapgolly_scalajs_react_test_emissions_CustomHooks$().Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook3.apply__O__O(void 0); + var sum = ((props.a | 0) + (hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (hook3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0; + var $$x1 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum))]; + var this$11 = $$x1.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("div", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); + return $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement.$f_Ljapgolly_scalajs_react_vdom_VdomElement__rawNode__sjs_js_$bar(this$11); +}; + +var $d_Ljapgolly_scalajs_react_test_emissions_CustomHooks$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_CustomHooks$: 0 +}, false, "japgolly.scalajs.react.test.emissions.CustomHooks$", { + Ljapgolly_scalajs_react_test_emissions_CustomHooks$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_CustomHooks$ }; +$c_Ljapgolly_scalajs_react_test_emissions_CustomHooks$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_CustomHooks$; +var $n_Ljapgolly_scalajs_react_test_emissions_CustomHooks$; + +function $m_Ljapgolly_scalajs_react_test_emissions_CustomHooks$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_CustomHooks$) { + $n_Ljapgolly_scalajs_react_test_emissions_CustomHooks$ = new $c_Ljapgolly_scalajs_react_test_emissions_CustomHooks$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_CustomHooks$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_CustomHooks$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out3.js new file mode 100644 index 000000000..9da71f900 --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out3.js @@ -0,0 +1,147 @@ +'use strict'; + +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024 from "./japgolly.scalajs.react.callback.Trampoline$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay from "./japgolly.scalajs.react.callback.Trampoline$Delay.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024$0024anon$00241 from "./japgolly.scalajs.react.hooks.Api$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.Api$$anon$2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary from "./japgolly.scalajs.react.hooks.Api$Primary.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00241 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Arg$0024 from "./japgolly.scalajs.react.hooks.CustomHook$Arg$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First from "./japgolly.scalajs.react.hooks.CustomHook$Builder$First.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024Subsequent from "./japgolly.scalajs.react.hooks.CustomHook$Builder$Subsequent.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024 from "./japgolly.scalajs.react.hooks.HookComponentBuilder$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024First from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentP$First.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024Subsequent from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentP$Subsequent.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024I1 from "./japgolly.scalajs.react.hooks.HookCtx$I1.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.Hooks$$anon$2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseEffectArg$.js"; +import * as $j_japgolly$002escalajs$002ereact$002epackage$0024 from "./japgolly.scalajs.react.package$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024 from "./japgolly.scalajs.react.util.EffectCallback$callback$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite from "./japgolly.scalajs.react.vdom.TagLite.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagMod from "./japgolly.scalajs.react.vdom.TagMod.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode from "./japgolly.scalajs.react.vdom.VdomNode.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002eFunction1 from "./scala.Function1.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction3 from "./scala.scalajs.runtime.AnonFunction3.js"; +import * as $j_scala$002escalajs$002eruntime$002eCompat$0024 from "./scala.scalajs.runtime.Compat$.js"; + +function $c_Ljapgolly_scalajs_react_test_emissions_CustomHooks$() { + this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook1 = null; + this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook2 = null; + this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook3 = null; + this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_Component = null; + $n_Ljapgolly_scalajs_react_test_emissions_CustomHooks$ = this; + var this$3 = $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_CustomHook.apply__Ljapgolly_scalajs_react_hooks_CustomHook$Builder$First(); + var initialState = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$1 => { + var _$1$1 = _$1 | 0; + + return 1 + _$1$1 | 0; + }); + var step = new $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First.$c_Ljapgolly_scalajs_react_hooks_CustomHook$Builder$FirstStep(); + this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useStateBy__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$3, initialState, step).buildReturning__F1__F1(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$2 => { + var _$2$1 = _$2; + return _$2$1.Ljapgolly_scalajs_react_hooks_HookCtx$I1__f_hook1; + })); + var this$8 = $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_CustomHook.apply__Ljapgolly_scalajs_react_hooks_CustomHook$Builder$First(); + var optionalParams$proxy1 = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); + var f$proxy3 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((optionalParams$proxy1$2 => () => { + console.log("hello", ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy1$2)); + })(optionalParams$proxy1)); + var effect = new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy3))); + var a = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); + var step$1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First.$c_Ljapgolly_scalajs_react_hooks_CustomHook$Builder$FirstStep(); + this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useEffect__O__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$8, effect, a, step$1).build__F1(); + var this$10 = $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_CustomHook.apply__Ljapgolly_scalajs_react_hooks_CustomHook$Builder$First(); + var initialState$1 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => 123); + var step$2 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First.$c_Ljapgolly_scalajs_react_hooks_CustomHook$Builder$FirstStep(); + this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useState__F0__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$10, initialState$1, step$2).buildReturning__F1__F1(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$3 => { + var _$3$1 = _$3; + return _$3$1.Ljapgolly_scalajs_react_hooks_HookCtx$I1__f_hook1; + })); + $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$(); + var this$14 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024.$m_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$().apply__Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$First(); + var hook = this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook1; + var step$3 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024First.$c_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$FirstStep(); + var a$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Arg$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$Arg$().exactId__F1(); + var d = new $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_hooks_Api$$anon$1(); + var this$18 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__custom__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__F1__Ljapgolly_scalajs_react_hooks_Api$DynamicNextStep__O(this$14, hook, step$3, a$1, d); + var hook$1 = this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook2; + var step$4 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$1(); + var this$16 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Arg$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$Arg$(); + var a$2 = this$16.const__O__F1(void 0); + var d$1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024$0024anon$00242.$c_Ljapgolly_scalajs_react_hooks_Api$$anon$2(); + var this$22 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__custom__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__F1__Ljapgolly_scalajs_react_hooks_Api$DynamicNextStep__O(this$18, hook$1, step$4, a$2, d$1); + var hook$2 = this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook3; + var step$5 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$1(); + var this$20 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Arg$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$Arg$(); + var a$3 = this$20.const__O__F1(void 0); + var d$2 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_hooks_Api$$anon$1(); + $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__custom__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__F1__Ljapgolly_scalajs_react_hooks_Api$DynamicNextStep__O(this$22, hook$2, step$5, a$3, d$2); + var f$proxy4 = new $j_scala$002escalajs$002eruntime$002eAnonFunction3.$c_sjsr_AnonFunction3((p, s1, s2) => { + var p$1 = p | 0; + var s1$1 = s1; + var s2$1 = s2; + var sum = (p$1 + (s1$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (s2$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; + var this$29 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self = "div"; + var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum))])); + return $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$29, self, xs); + }); + new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00242.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$2(); + var s$proxy1 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); + + var rawComponent = ((this$7$1, f$proxy4$2) => props => { + var hook1_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Arg$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$Arg$().exactId__F1().apply__O__O(props.a) | 0; + var hook1 = this$7$1.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook1.apply__O__O(hook1_arg); + this$7$1.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook2.apply__O__O(void 0); + var hook3 = this$7$1.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook3.apply__O__O(void 0); + return f$proxy4$2.apply__O__O__O__O(props.a, hook1, hook3).rawNode__O(); + })(this, f$proxy4); + + var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$31 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$31.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s$proxy1)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_CustomHooks$ }; +$c_Ljapgolly_scalajs_react_test_emissions_CustomHooks$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_CustomHooks$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_CustomHooks$; + +function $h_Ljapgolly_scalajs_react_test_emissions_CustomHooks$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_CustomHooks$ }; +$h_Ljapgolly_scalajs_react_test_emissions_CustomHooks$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_CustomHooks$.prototype; +var $d_Ljapgolly_scalajs_react_test_emissions_CustomHooks$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_CustomHooks$: 0 +}, false, "japgolly.scalajs.react.test.emissions.CustomHooks$", { + Ljapgolly_scalajs_react_test_emissions_CustomHooks$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_CustomHooks$ }; +$c_Ljapgolly_scalajs_react_test_emissions_CustomHooks$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_CustomHooks$; +var $n_Ljapgolly_scalajs_react_test_emissions_CustomHooks$; + +function $m_Ljapgolly_scalajs_react_test_emissions_CustomHooks$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_CustomHooks$) { + $n_Ljapgolly_scalajs_react_test_emissions_CustomHooks$ = new $c_Ljapgolly_scalajs_react_test_emissions_CustomHooks$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_CustomHooks$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_CustomHooks$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out2.js new file mode 100644 index 000000000..3d141caff --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out2.js @@ -0,0 +1,119 @@ +'use strict'; + +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary from "./japgolly.scalajs.react.hooks.Api$Primary.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024 from "./japgolly.scalajs.react.hooks.CustomHook$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First from "./japgolly.scalajs.react.hooks.CustomHook$Builder$First.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024Subsequent from "./japgolly.scalajs.react.hooks.CustomHook$Builder$Subsequent.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024I1 from "./japgolly.scalajs.react.hooks.HookCtx$I1.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2 from "./japgolly.scalajs.react.hooks.HookCtx$P2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF from "./japgolly.scalajs.react.hooks.Hooks$UseStateF.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 from "./japgolly.scalajs.react.internal.Singleton$.js"; +import * as $j_japgolly$002escalajs$002ereact$002epackage$0024 from "./japgolly.scalajs.react.package$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement from "./japgolly.scalajs.react.vdom.VdomElement.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002eFunction1 from "./scala.Function1.js"; +import * as $j_scala$002escalajs$002eruntime$002eWrappedVarArgs from "./scala.scalajs.runtime.WrappedVarArgs.js"; + +function $c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$() { + this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook1 = null; + this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook2 = null; + this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook3 = null; + this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_Component = null; + $n_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$ = this; + var this$3 = $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_CustomHook.apply__Ljapgolly_scalajs_react_hooks_CustomHook$Builder$First(); + var initialState = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$1$2 => { + var x$1 = x$1$2 | 0; + return 1 + x$1 | 0; + }); + var step = new $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First.$c_Ljapgolly_scalajs_react_hooks_CustomHook$Builder$FirstStep(); + this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useStateBy__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$3, initialState, step).buildReturning__F1__F1(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$2$2 => { + var x$2 = x$2$2; + return x$2.Ljapgolly_scalajs_react_hooks_HookCtx$I1__f_hook1; + })); + var this$5 = $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_CustomHook.apply__Ljapgolly_scalajs_react_hooks_CustomHook$Builder$First(); + var initialState$1 = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$3$2 => { + var x$3 = x$3$2 | 0; + return x$3 << 1; + }); + var step$1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First.$c_Ljapgolly_scalajs_react_hooks_CustomHook$Builder$FirstStep(); + this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useStateBy__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$5, initialState$1, step$1).buildReturning__F1__F1(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$4$2 => { + var x$4 = x$4$2; + return x$4.Ljapgolly_scalajs_react_hooks_HookCtx$I1__f_hook1; + })); + var this$7 = $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_CustomHook.apply__Ljapgolly_scalajs_react_hooks_CustomHook$Builder$First(); + var initialState$2 = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$5$2 => { + var x$5 = x$5$2 | 0; + return Math.imul(3, x$5); + }); + var step$2 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First.$c_Ljapgolly_scalajs_react_hooks_CustomHook$Builder$FirstStep(); + this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useStateBy__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$7, initialState$2, step$2).buildReturning__F1__F1(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$6$2 => { + var x$6 = x$6$2; + return x$6.Ljapgolly_scalajs_react_hooks_HookCtx$I1__f_hook1; + })); + + var rawComponent = arg1$2 => $m_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$().japgolly$scalajs$react$test$emissions$CustomHooksBy$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2); + + var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$8 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$(), null)); + this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$8.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$ }; +$c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$; + +function $h_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$ }; +$h_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$.prototype; + +$c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$.prototype.japgolly$scalajs$react$test$emissions$CustomHooksBy$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = function (props) { + var hook1_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1($m_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$().Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook1, -1 + (props.a | 0) | 0); + var hook1 = hook1_raw.apply__O__O(void 0); + var hook2_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1($m_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$().Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook2, hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]); + var hook2 = hook2_raw.apply__O__O(void 0); + var props$1 = props.a; + var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$1, hook1, hook2); + var $$x2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); + var $$x1 = $m_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$().Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook3; + var this$2 = hook3_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; + var hook3_raw = $$x2.apply$extension__F1__O__F1($$x1, this$2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]); + var hook3 = hook3_raw.apply__O__O(void 0); + var sum = (((props.a | 0) + (hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (hook3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0; + var $$x3 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum))]; + var this$12 = $$x3.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("div", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); + return $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement.$f_Ljapgolly_scalajs_react_vdom_VdomElement__rawNode__sjs_js_$bar(this$12); +}; + +var $d_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$: 0 +}, false, "japgolly.scalajs.react.test.emissions.CustomHooksBy$", { + Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$ }; +$c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$; +var $n_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$; + +function $m_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$) { + $n_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$ = new $c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out3.js new file mode 100644 index 000000000..0eea5c29e --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out3.js @@ -0,0 +1,166 @@ +'use strict'; + +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024$0024anon$00241 from "./japgolly.scalajs.react.hooks.Api$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary from "./japgolly.scalajs.react.hooks.Api$Primary.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Secondary from "./japgolly.scalajs.react.hooks.Api$Secondary.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00241 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00243 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$3.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook from "./japgolly.scalajs.react.hooks.CustomHook.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First from "./japgolly.scalajs.react.hooks.CustomHook$Builder$First.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024Subsequent from "./japgolly.scalajs.react.hooks.CustomHook$Builder$Subsequent.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024 from "./japgolly.scalajs.react.hooks.HookComponentBuilder$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024First from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentP$First.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024Subsequent from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentP$Subsequent.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024I1 from "./japgolly.scalajs.react.hooks.HookCtx$I1.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2 from "./japgolly.scalajs.react.hooks.HookCtx$P2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.Hooks$$anon$2.js"; +import * as $j_japgolly$002escalajs$002ereact$002epackage$0024 from "./japgolly.scalajs.react.package$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite from "./japgolly.scalajs.react.vdom.TagLite.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagMod from "./japgolly.scalajs.react.vdom.TagMod.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode from "./japgolly.scalajs.react.vdom.VdomNode.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002eFunction1 from "./scala.Function1.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction2 from "./scala.scalajs.runtime.AnonFunction2.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction4 from "./scala.scalajs.runtime.AnonFunction4.js"; + +function $c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$() { + this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook1 = null; + this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook2 = null; + this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook3 = null; + this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_Component = null; + $n_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$ = this; + var this$3 = $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_CustomHook.apply__Ljapgolly_scalajs_react_hooks_CustomHook$Builder$First(); + var initialState = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$1 => { + var _$1$1 = _$1 | 0; + + return 1 + _$1$1 | 0; + }); + var step = new $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First.$c_Ljapgolly_scalajs_react_hooks_CustomHook$Builder$FirstStep(); + this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useStateBy__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$3, initialState, step).buildReturning__F1__F1(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$2 => { + var _$2$1 = _$2; + return _$2$1.Ljapgolly_scalajs_react_hooks_HookCtx$I1__f_hook1; + })); + var this$5 = $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_CustomHook.apply__Ljapgolly_scalajs_react_hooks_CustomHook$Builder$First(); + var initialState$1 = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$3 => { + var _$3$1 = _$3 | 0; + + return _$3$1 << 1; + }); + var step$1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First.$c_Ljapgolly_scalajs_react_hooks_CustomHook$Builder$FirstStep(); + this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useStateBy__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$5, initialState$1, step$1).buildReturning__F1__F1(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$4 => { + var _$4$1 = _$4; + return _$4$1.Ljapgolly_scalajs_react_hooks_HookCtx$I1__f_hook1; + })); + var this$7 = $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_CustomHook.apply__Ljapgolly_scalajs_react_hooks_CustomHook$Builder$First(); + var initialState$2 = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$5 => { + var _$5$1 = _$5 | 0; + + return Math.imul(3, _$5$1); + }); + var step$2 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First.$c_Ljapgolly_scalajs_react_hooks_CustomHook$Builder$FirstStep(); + this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useStateBy__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$7, initialState$2, step$2).buildReturning__F1__F1(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$6 => { + var _$6$1 = _$6; + return _$6$1.Ljapgolly_scalajs_react_hooks_HookCtx$I1__f_hook1; + })); + $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$(); + var this$11 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024.$m_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$().apply__Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$First(); + var hook = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1((this$7$1 => v1 => { + var p = v1 | 0; + return new $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook.$c_Ljapgolly_scalajs_react_hooks_CustomHook($j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1(this$7$1.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook1, -1 + p | 0)); + })(this)); + var step$3 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024First.$c_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$FirstStep(); + var d = new $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_hooks_Api$$anon$1(); + var this$14 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__customBy__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__Ljapgolly_scalajs_react_hooks_Api$DynamicNextStep__O(this$11, hook, step$3, d); + var hook$1 = new $j_scala$002escalajs$002eruntime$002eAnonFunction2.$c_sjsr_AnonFunction2((this$8$1 => (v1$2, v2) => { + var s1 = v2; + return new $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook.$c_Ljapgolly_scalajs_react_hooks_CustomHook($j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1(this$8$1.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook2, s1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0])); + })(this)); + var step$4 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$1(); + var d$1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_hooks_Api$$anon$1(); + var this$18 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Secondary.$f_Ljapgolly_scalajs_react_hooks_Api$Secondary__customBy__O__Ljapgolly_scalajs_react_hooks_Api$SubsequentStep__Ljapgolly_scalajs_react_hooks_Api$DynamicNextStep__O(this$14, hook$1, step$4, d$1); + var hook$2 = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1((this$9$1 => δ => { + var δ$1 = δ; + var $$x2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); + var $$x1 = this$9$1.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook3; + var this$15 = δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; + return new $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook.$c_Ljapgolly_scalajs_react_hooks_CustomHook($$x2.apply$extension__F1__O__F1($$x1, this$15.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0])); + })(this)); + var step$5 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00242.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$2(); + var d$2 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_hooks_Api$$anon$1(); + $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__customBy__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__Ljapgolly_scalajs_react_hooks_Api$DynamicNextStep__O(this$18, hook$2, step$5, d$2); + var f$proxy1 = new $j_scala$002escalajs$002eruntime$002eAnonFunction4.$c_sjsr_AnonFunction4((p$1, s1$1, s2, s3) => { + var p$2 = p$1 | 0; + var s1$2 = s1$1; + var s2$1 = s2; + var s3$1 = s3; + var sum = ((p$2 + (s1$2.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (s2$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (s3$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; + var this$25 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self = "div"; + var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum))])); + return $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$25, self, xs); + }); + new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00243.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$3(); + var s$proxy1 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); + + var rawComponent = ((this$11$1, f$proxy1$2) => props => { + var p$3 = props.a | 0; + var hook1_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1(this$11$1.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook1, -1 + p$3 | 0); + var hook1 = hook1_raw.apply__O__O(void 0); + props.a | 0; + var hook2_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1(this$11$1.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook2, hook1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); + var hook2 = hook2_raw.apply__O__O(void 0); + var props$1 = props.a; + var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, hook1, hook2); + var $$x4 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); + var $$x3 = this$11$1.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook3; + var this$28 = hook3_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; + var hook3_raw = $$x4.apply$extension__F1__O__F1($$x3, this$28.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); + var hook3 = hook3_raw.apply__O__O(void 0); + return f$proxy1$2.apply__O__O__O__O__O(props.a, hook1, hook2, hook3).rawNode__O(); + })(this, f$proxy1); + + var $$x5 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$29 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_Component = $$x5.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$29.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s$proxy1)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$ }; +$c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$; + +function $h_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$ }; +$h_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$.prototype; +var $d_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$: 0 +}, false, "japgolly.scalajs.react.test.emissions.CustomHooksBy$", { + Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$ }; +$c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$; +var $n_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$; + +function $m_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$) { + $n_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$ = new $c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$ }; diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala index 85643453e..fc0fa84ef 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala @@ -23,6 +23,8 @@ object ReactRefreshTest extends TestSuite { } "sjr" - { + "CustomHooks" - testScala(assertRR = false) // TODO: + "CustomHooksBy" - testScala(assertRR = false) // TODO: "HooksWithJsFns" - testScala() "HooksWithScalaFns" - testScala() "HooksWithChildren" - testScala() diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala index 66df409ad..6658fcc9d 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala @@ -77,7 +77,9 @@ object TestJs { apply(_ .filterNot(_ startsWith "import ") .modify(_ - .replace("PropsChildren$", "PropsChildren") // Not sure why SJS sometimes emits one or the other + // Not sure why SJS sometimes emits one or the other of the following + .replace("PropsChildren$", "PropsChildren") + .replace("$FirstStep.$", "$First.$") // Scala 3 only ) ) From 7275c97c9e5e0d373cd9d8b2a6f5d753a0ca2a32 Mon Sep 17 00:00:00 2001 From: David Barri Date: Thu, 16 Jun 2022 10:18:49 +1000 Subject: [PATCH 42/72] Upgrade react-refresh to 0.14.0 (identical to 0.13.0 anyway) --- library/testEmissions/jvm/src/test/node/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/testEmissions/jvm/src/test/node/package.json b/library/testEmissions/jvm/src/test/node/package.json index 41dbf2dda..e5e21079d 100644 --- a/library/testEmissions/jvm/src/test/node/package.json +++ b/library/testEmissions/jvm/src/test/node/package.json @@ -5,6 +5,6 @@ "dependencies": { "@babel/cli": "^7.17.6", "@babel/core": "^7.17.5", - "react-refresh": "^0.13.0" + "react-refresh": "^0.14.0" } } From 1a13dfecacba8a50663d6f7467d14fdc88cced4c Mon Sep 17 00:00:00 2001 From: David Barri Date: Thu, 16 Jun 2022 11:44:44 +1000 Subject: [PATCH 43/72] Oh no, custom hooks need rewriting too --- library/TODO.md | 2 + .../test/resources/rr-js/custom_hooks-in.js | 23 +++++++++++ .../test/resources/rr-js/custom_hooks-out.js | 40 +++++++++++++++++++ .../test/emissions/ReactRefreshTest.scala | 17 +++++--- 4 files changed, 76 insertions(+), 6 deletions(-) create mode 100644 library/testEmissions/jvm/src/test/resources/rr-js/custom_hooks-in.js create mode 100644 library/testEmissions/jvm/src/test/resources/rr-js/custom_hooks-out.js diff --git a/library/TODO.md b/library/TODO.md index 88dc8776d..d08c7081b 100644 --- a/library/TODO.md +++ b/library/TODO.md @@ -71,4 +71,6 @@ /* [--] */ def renderWithReuse (f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C], r: Reusability[Ctx]): Component[P, s.CT] /* [--] */ def renderWithReuseBy [A](reusableInputs: Ctx => A)(f: A => VdomNode)(implicit s: CtorType.Summoner[Box[P], C], r: Reusability[A]): Component[P, s.CT] /* [--] */ def renderWithReuseBy [A](reusableInputs: CtxFn[A])(f: A => VdomNode)(implicit step: Step, s: CtorType.Summoner[Box[P], C], r: Reusability[A]): Component[P, s.CT] + +// Custom hooks need rewriting too - see the JS only example. This is going to be time-consuming... Will have to make it low-priority for now... ``` diff --git a/library/testEmissions/jvm/src/test/resources/rr-js/custom_hooks-in.js b/library/testEmissions/jvm/src/test/resources/rr-js/custom_hooks-in.js new file mode 100644 index 000000000..18a37e038 --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-js/custom_hooks-in.js @@ -0,0 +1,23 @@ +import { useState, useEffect } from 'react'; + +function useFriendStatus(id) { + const [isOnline, setIsOnline] = useState(null); + + useEffect(() => { + setIsOnline(true); + return () => {}; + }); + + return isOnline; +} + +function FriendStatus(props) { + const isOnline = useFriendStatus(props.friend.id); + + if (isOnline === null) { + return 'Loading...'; + } + return isOnline ? 'Online' : 'Offline'; +} + +export default FriendStatus diff --git a/library/testEmissions/jvm/src/test/resources/rr-js/custom_hooks-out.js b/library/testEmissions/jvm/src/test/resources/rr-js/custom_hooks-out.js new file mode 100644 index 000000000..cb186b800 --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-js/custom_hooks-out.js @@ -0,0 +1,40 @@ +var _s = $RefreshSig$(), + _s2 = $RefreshSig$(); + +import { useState, useEffect } from 'react'; + +function useFriendStatus(id) { + _s(); + + const [isOnline, setIsOnline] = useState(null); + useEffect(() => { + setIsOnline(true); + return () => {}; + }); + return isOnline; +} + +_s(useFriendStatus, "HLSnnfJYDaeB5hXQTNbVZdmJwXQ="); + +function FriendStatus(props) { + _s2(); + + const isOnline = useFriendStatus(props.friend.id); + + if (isOnline === null) { + return 'Loading...'; + } + + return isOnline ? 'Online' : 'Offline'; +} + +_s2(FriendStatus, "a3B569k9rI2h5KE8Nx8Iioa8o4I=", false, function () { + return [useFriendStatus]; +}); + +_c = FriendStatus; +export default FriendStatus; + +var _c; + +$RefreshReg$(_c, "FriendStatus"); diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala index fc0fa84ef..b7956f0ef 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala @@ -19,6 +19,7 @@ object ReactRefreshTest extends TestSuite { "js" - { "fn" - testJs() "hooks" - testJs() + "custom_hooks" - testJs() // "temp" - testJs() } @@ -194,13 +195,17 @@ object ReactRefreshTest extends TestSuite { utestOutput } - private val rrSigHashRegex = """.*, ?"([a-zA-Z0-9/+]{27}=)"\);.*""".r + private val rrSigRegex = """^.*(?:_s.*|},) "([a-zA-Z0-9/+]{27}=)"(?:, .+|\);)?$""".r - private def reactRefreshSignature(js: String): Option[String] = - js.replace('\n', ' ') match { - case rrSigHashRegex(h) => Some(h) - case _ => None - } + private def reactRefreshSignature(js: String): Option[String] = { + val all: String = + js.linesIterator.flatMap { + case rrSigRegex(h) => Some(h) + case _ => None + }.mkString(" / ") + + Option.when(all.nonEmpty)(all) + } private def testOutputFromSig(js: String, expect: JBoolean): Any = if (expect == false) From 931a8d328145e2113490a593b9f3db0ad288c556 Mon Sep 17 00:00:00 2001 From: David Barri Date: Thu, 16 Jun 2022 12:04:35 +1000 Subject: [PATCH 44/72] Gonna have to add `renderRR` and leave `render` alone A few reasons: * https://github.com/lampepfl/dotty/issues/15435 requires an extension method * it's actually better to make it opt-in for now until it's fully stable, seeing as it's turning out to be more complex than expected * similarly, having the ability to use the existing, stable, render method would be advantageous if an unexpected error occurs in renderRR --- .../scalajs/react/hooks/HookMacrosTraits.scala | 14 +++----------- .../japgolly/scalajs/react/hooks/HookMacros.scala | 2 +- .../scalajs/react/hooks/HookMacrosTraits.scala | 14 +++----------- .../scalajs/react/hooks/AbstractHookMacros.scala | 2 +- .../scala/japgolly/scalajs/react/hooks/Api.scala | 6 ++---- .../react/test/emissions/HooksWithScalaFns.scala | 2 +- .../react/test/emissions/HooksWithScalaFns.scala | 2 +- .../scalajs/react/test/emissions/CustomHooks.scala | 2 +- .../react/test/emissions/CustomHooksBy.scala | 2 +- .../react/test/emissions/HooksWithChildren.scala | 2 +- .../react/test/emissions/HooksWithJsFns.scala | 2 +- .../scalajs/react/test/emissions/UseState.scala | 2 +- .../react/test/emissions/UseStateWithReuse.scala | 2 +- .../resources/rr-sjr/HooksWithScalaFns-out3.js | 13 ++++++------- .../react/core/ScalaSpecificHooksTest.scala | 2 +- 15 files changed, 25 insertions(+), 44 deletions(-) diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacrosTraits.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacrosTraits.scala index 12c2b3cc8..c243dfe3e 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacrosTraits.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacrosTraits.scala @@ -6,20 +6,12 @@ import japgolly.scalajs.react.internal.Box import japgolly.scalajs.react.vdom.VdomNode import japgolly.scalajs.react.{Children, CtorType} -trait ApiSecondaryWithRenderMacrosBinCompat[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] { +trait ApiSecondaryWithRenderMacros[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] { self: PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step] => - def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = - render(step.squash(f)(_)) -} - -trait ApiSecondaryWithRenderMacros[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] - extends ApiSecondaryWithRenderMacrosBinCompat[P, C, Ctx, CtxFn, Step] { - self: PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step] => - - final override def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = + final def renderRR(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = macro HookMacros.render[P, C, Ctx, CtxFn, Step] - final def renderDebug(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = + final def renderRRDebug(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = macro HookMacros.renderDebug[P, C, Ctx, CtxFn, Step] } diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala index 8dbdba25a..0e693030a 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala @@ -204,7 +204,7 @@ object HookMacros { // log("self", self.asTerm.underlying.show) val renderStep = - HookStep("render", Nil, List(List(f.asTerm), List(step.asTerm, s.asTerm))) + HookStep("renderRR", Nil, List(List(f.asTerm), List(step.asTerm, s.asTerm))) val rewriteAttempt = for { diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala index 64e56d204..a3ef36529 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala @@ -15,20 +15,12 @@ import scala.quoted.* import scala.reflect.ClassTag import scala.scalajs.js -trait ApiSecondaryWithRenderMacrosBinCompat[P, C <: Children, Ctx, CtxFn[_], _Step <: SubsequentStep[Ctx, CtxFn]] { +trait ApiSecondaryWithRenderMacros[P, C <: Children, Ctx, CtxFn[_], _Step <: SubsequentStep[Ctx, CtxFn]] { self: PrimaryWithRender[P, C, Ctx, _Step] with Secondary[Ctx, CtxFn, _Step] => - def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = - render(step.squash(f)(_)) -} - -trait ApiSecondaryWithRenderMacros[P, C <: Children, Ctx, CtxFn[_], _Step <: SubsequentStep[Ctx, CtxFn]] - extends ApiSecondaryWithRenderMacrosBinCompat[P, C, Ctx, CtxFn, _Step] { - self: PrimaryWithRender[P, C, Ctx, _Step] with Secondary[Ctx, CtxFn, _Step] => - - inline override final def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = + inline final def renderRR(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = HookMacros.renderWorkaround[P, C, Ctx, CtxFn, Step, s.CT](this, f, step, s) - inline final def renderDebug(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = + inline final def renderRRDebug(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = HookMacros.renderWorkaroundDebug[P, C, Ctx, CtxFn, Step, s.CT](this, f, step, s) } diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala index cc100accd..4f8cbd6f4 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala @@ -364,7 +364,7 @@ trait AbstractHookMacros { log("rewriteRender:" + step.name, step) step.name match { - case "render" | "renderDebug" => + case "renderRR" | "renderRRDebug" => val List(List(renderFn), _) = step.args : @nowarn Right(b => call(renderFn, b.args)) diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Api.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Api.scala index 6e1a2aa63..98b769960 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Api.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Api.scala @@ -692,10 +692,8 @@ object Api { trait SecondaryWithRender[P, C <: Children, Ctx, CtxFn[_], _Step <: SubsequentStep[Ctx, CtxFn]] extends PrimaryWithRender[P, C, Ctx, _Step] with Secondary[Ctx, CtxFn, _Step] with ApiSecondaryWithRenderMacros[P, C, Ctx, CtxFn, _Step] { - // This has been moved into HookMacros.ApiSecondaryWithRenderMacros - // - // final def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = - // render(step.squash(f)(_)) + final def render(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = + render(step.squash(f)(_)) final def renderReusable[A](f: CtxFn[Reusable[A]])(implicit step: Step, s: CtorType.Summoner[Box[P], C], v: A => VdomNode): Component[P, s.CT] = renderReusable(step.squash(f)(_)) diff --git a/library/testEmissions/js/src/main/scala-2/japgolly/scalajs/react/test/emissions/HooksWithScalaFns.scala b/library/testEmissions/js/src/main/scala-2/japgolly/scalajs/react/test/emissions/HooksWithScalaFns.scala index 0f3ae70d7..8997eb0b3 100644 --- a/library/testEmissions/js/src/main/scala-2/japgolly/scalajs/react/test/emissions/HooksWithScalaFns.scala +++ b/library/testEmissions/js/src/main/scala-2/japgolly/scalajs/react/test/emissions/HooksWithScalaFns.scala @@ -33,5 +33,5 @@ object HooksWithScalaFns { .useStateBy(state1(_, _)) .useStateBy(state2) .useStateBy(state3) - .render(render _) + .renderRR(render _) } diff --git a/library/testEmissions/js/src/main/scala-3/japgolly/scalajs/react/test/emissions/HooksWithScalaFns.scala b/library/testEmissions/js/src/main/scala-3/japgolly/scalajs/react/test/emissions/HooksWithScalaFns.scala index 87088bddf..3b514c822 100644 --- a/library/testEmissions/js/src/main/scala-3/japgolly/scalajs/react/test/emissions/HooksWithScalaFns.scala +++ b/library/testEmissions/js/src/main/scala-3/japgolly/scalajs/react/test/emissions/HooksWithScalaFns.scala @@ -33,5 +33,5 @@ object HooksWithScalaFns { .useStateBy(state1) .useStateBy(state2) .useStateBy(state3) - .render(render) + .renderRR(render) } diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/CustomHooks.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/CustomHooks.scala index 6a8edf833..e8c3578a8 100644 --- a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/CustomHooks.scala +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/CustomHooks.scala @@ -13,7 +13,7 @@ object CustomHooks { .custom(customHook1) .custom(customHook2) .custom(customHook3) - .render { (p, s1, s2) => + .renderRR { (p, s1, s2) => val sum = p + s1.value + s2.value <.div("Sum = ", sum) } diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/CustomHooksBy.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/CustomHooksBy.scala index 511c5de41..13d520139 100644 --- a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/CustomHooksBy.scala +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/CustomHooksBy.scala @@ -13,7 +13,7 @@ object CustomHooksBy { .customBy(p => customHook1(p - 1)) .customBy((_, s1) => customHook2(s1.value)) .customBy($ => customHook3($.hook2.value)) - .render { (p, s1, s2, s3) => + .renderRR { (p, s1, s2, s3) => val sum = p + s1.value + s2.value + s3.value <.div("Sum = ", sum) } diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksWithChildren.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksWithChildren.scala index 8254de9e8..c3a36bb14 100644 --- a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksWithChildren.scala +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksWithChildren.scala @@ -8,7 +8,7 @@ object HooksWithChildren { val Component = ScalaFnComponent.withHooks[Int] .withPropsChildren .useState(123) - .render { (p, c, s1) => + .renderRR { (p, c, s1) => val sum = p + s1.value + c.count <.button( "Sum = ", sum, diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksWithJsFns.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksWithJsFns.scala index f38ed39b1..ae733d392 100644 --- a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksWithJsFns.scala +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksWithJsFns.scala @@ -31,5 +31,5 @@ object HooksWithJsFns { .useState(jsState0()) .useStateBy(jsState1) .useStateBy(jsState2) - .render(render) + .renderRR(render) } diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseState.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseState.scala index fa0e3bd99..a1d53a761 100644 --- a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseState.scala +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseState.scala @@ -9,7 +9,7 @@ object UseState { .useState(123) .useStateBy((p, s1) => p + s1.value) .useStateBy($ => $.props + $.hook1.value + $.hook2.value) - .render { (_, s1, s2, s3) => + .renderRR { (_, s1, s2, s3) => val sum = s1.value + s2.value + s3.value <.button( "Sum = ", sum, diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseStateWithReuse.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseStateWithReuse.scala index f5445761f..4d94a70b3 100644 --- a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseStateWithReuse.scala +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseStateWithReuse.scala @@ -9,7 +9,7 @@ object UseStateWithReuse { .useStateWithReuse(123) .useStateWithReuseBy((p, s1) => p + s1.value) .useStateWithReuseBy($ => $.props + $.hook1.value + $.hook2.value) - .render { (_, s1, s2, s3) => + .renderRR { (_, s1, s2, s3) => val sum = s1.value + s2.value + s3.value <.button( "DEBUG = ", sum, diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out3.js index 8b2cf6cdb..633da63c3 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out3.js @@ -13,7 +13,7 @@ import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubse import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00243 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$3.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00244 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$4.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024 from "./japgolly.scalajs.react.hooks.HookComponentBuilder$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024FirstStep from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentP$FirstStep.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024First from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentP$First.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024Subsequent from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentP$Subsequent.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2 from "./japgolly.scalajs.react.hooks.HookCtx$P2.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.Hooks$$anon$2.js"; @@ -25,7 +25,7 @@ import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./ import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite from "./japgolly.scalajs.react.vdom.TagLite.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagMod from "./japgolly.scalajs.react.vdom.TagMod.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement from "./japgolly.scalajs.react.vdom.VdomElement.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode from "./japgolly.scalajs.react.vdom.VdomNode.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; @@ -88,7 +88,7 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$() { $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$(); var this$6 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024.$m_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$().apply__Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$First(); var initialState = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => 123); - var step = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024FirstStep.$c_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$FirstStep(); + var step = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024First.$c_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$FirstStep(); var this$8 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useState__F0__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$6, initialState, step); var initialState$1 = new $j_scala$002escalajs$002eruntime$002eAnonFunction2.$c_sjsr_AnonFunction2((this$4$1 => (p, s) => { var p$1 = p | 0; @@ -134,14 +134,13 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$() { var hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); var hook4_raw = $i_react.useState(((this$4$2, props$3, hook1$3, hook2$2, hook3$2) => () => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(this$4$2.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state3.apply__O__O__O__O__O(props$3.a, hook1$3, hook2$2, hook3$2)))(this$6$1, props, hook1, hook2, hook3)); var hook4 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook4_raw); - var this$16 = f$proxy1$2.apply__O__O__O__O__O__O(props.a, hook1, hook2, hook3, hook4); - return this$16.rawElement__Ljapgolly_scalajs_react_facade_React$Element(); + return f$proxy1$2.apply__O__O__O__O__O__O(props.a, hook1, hook2, hook3, hook4).rawNode__O(); }, "utTcF5dA/IeeOyCNxp/nYadVY3U="); })(this, f$proxy1); var $$x4 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); - var this$17 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); - this.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_Component = $$x4.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$17.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s$proxy1)); + var this$16 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + this.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_Component = $$x4.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$16.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s$proxy1)); } export { $c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$ }; diff --git a/library/tests/src/test/scala-3/japgolly/scalajs/react/core/ScalaSpecificHooksTest.scala b/library/tests/src/test/scala-3/japgolly/scalajs/react/core/ScalaSpecificHooksTest.scala index 1e72da1b2..e671d5e35 100644 --- a/library/tests/src/test/scala-3/japgolly/scalajs/react/core/ScalaSpecificHooksTest.scala +++ b/library/tests/src/test/scala-3/japgolly/scalajs/react/core/ScalaSpecificHooksTest.scala @@ -23,7 +23,7 @@ class ScalaSpecificHooksTest { .customBy((p, s, _) => hookE(p.pi + s.value)) .customBy($ => hookE($.props.pi + $.hook1.value + 1)) .customBy($ => hookS($.props.pi + $.hook1.value + 1)) // <--- s3 - .renderDebug((_, s1, s2, s3) => + .render((_, s1, s2, s3) => <.div( s"${s1.value}:${s2.value}:${s3.value}", <.button(^.onClick --> s1.modState(_ + 1)) From cbdd9900666c8d0497aad0b20e20102de3d3324c Mon Sep 17 00:00:00 2001 From: David Barri Date: Thu, 16 Jun 2022 12:20:39 +1000 Subject: [PATCH 45/72] Test hook components with `.render` and with `.renderRR` --- .../react/core/ScalaSpecificHooksTest.scala | 36 +- .../react/core/ScalaSpecificHooksTest.scala | 41 +- .../scalajs/react/core/HooksRRTest.scala | 1347 +++++++++++++++++ .../scalajs/react/core/HooksTest.scala | 7 +- 4 files changed, 1415 insertions(+), 16 deletions(-) create mode 100644 library/tests/src/test/scala/japgolly/scalajs/react/core/HooksRRTest.scala diff --git a/library/tests/src/test/scala-2/japgolly/scalajs/react/core/ScalaSpecificHooksTest.scala b/library/tests/src/test/scala-2/japgolly/scalajs/react/core/ScalaSpecificHooksTest.scala index f3cfcb55a..fbf9e53a9 100644 --- a/library/tests/src/test/scala-2/japgolly/scalajs/react/core/ScalaSpecificHooksTest.scala +++ b/library/tests/src/test/scala-2/japgolly/scalajs/react/core/ScalaSpecificHooksTest.scala @@ -4,16 +4,14 @@ import japgolly.scalajs.react._ import japgolly.scalajs.react.test.TestUtil._ import japgolly.scalajs.react.vdom.html_<^._ -class ScalaSpecificHooksTest { +object ScalaSpecificHooksTest { import HooksTest._ - private val hookS = CustomHook[Int].useStateBy(identity).buildReturning(_.hook1) - // TODO: https://github.com/lampepfl/dotty/issues/12663 // This is the original version def testCustomHook(): Unit = { val counter = new Counter - + val hookS = CustomHook[Int].useStateBy(identity).buildReturning(_.hook1) val hookE = CustomHook[Int].useEffectBy(counter.incCB(_)).build val comp = ScalaFnComponent.withHooks[PI] @@ -40,4 +38,34 @@ class ScalaSpecificHooksTest { } } + // Copy of above but using renderRR + def testCustomHookRR(): Unit = { + val counter = new Counter + val hookS = CustomHook[Int].useStateBy(identity).buildReturning(_.hook1) + val hookE = CustomHook[Int].useEffectBy(counter.incCB(_)).build + + val comp = ScalaFnComponent.withHooks[PI] + .custom(hookE(10)) + .custom(hookS(3)) // <--------------------------------------- s1 + .custom(hookS.contramap[PI](_.pi)) // <---------------------- s2 + .customBy((p, s, _) => hookE(p.pi + s.value)) + .customBy($ => hookS($.props.pi + $.hook1.value + 1)) // <--- s3 + .customBy($ => hookE($.props.pi + $.hook1.value + 1)) + .renderRR((_, s1, s2, s3) => + <.div( + s"${s1.value}:${s2.value}:${s3.value}", + <.button(^.onClick --> s1.modState(_ + 1)) + ) + ) + + test(comp(PI(5))) { t => + t.assertText("3:5:9") + assertEq(counter.value, 10 + (5+3) + (5+3+1)) + counter.value = 0 + t.clickButton() + t.assertText("4:5:9") + assertEq(counter.value, 10 + (5+4) + (5+4+1)) + } + } + } diff --git a/library/tests/src/test/scala-3/japgolly/scalajs/react/core/ScalaSpecificHooksTest.scala b/library/tests/src/test/scala-3/japgolly/scalajs/react/core/ScalaSpecificHooksTest.scala index e671d5e35..c804ddc12 100644 --- a/library/tests/src/test/scala-3/japgolly/scalajs/react/core/ScalaSpecificHooksTest.scala +++ b/library/tests/src/test/scala-3/japgolly/scalajs/react/core/ScalaSpecificHooksTest.scala @@ -4,17 +4,15 @@ import japgolly.scalajs.react._ import japgolly.scalajs.react.test.TestUtil._ import japgolly.scalajs.react.vdom.html_<^._ -class ScalaSpecificHooksTest { +object ScalaSpecificHooksTest { import HooksTest._ - // TODO: These have been moved outside due to https://github.com/lampepfl/dotty/issues/15435 - private val counter = new Counter - private val hookS = CustomHook[Int].useStateBy(identity).buildReturning(_.hook1) - private val hookE = CustomHook[Int].useEffectBy(counter.incCB(_)).build - // TODO: https://github.com/lampepfl/dotty/issues/12663 // I swapped the order of the last two hooks to avoid use of a CtxFn after a DynamicNextStep. def testCustomHook(): Unit = { + val counter = new Counter + val hookS = CustomHook[Int].useStateBy(identity).buildReturning(_.hook1) + val hookE = CustomHook[Int].useEffectBy(counter.incCB(_)).build val comp = ScalaFnComponent.withHooks[PI] .custom(hookE(10)) @@ -40,4 +38,35 @@ class ScalaSpecificHooksTest { } } + + // Copy of above but using renderRR + def testCustomHookRR(): Unit = { + val counter = new Counter + val hookS = CustomHook[Int].useStateBy(identity).buildReturning(_.hook1) + val hookE = CustomHook[Int].useEffectBy(counter.incCB(_)).build + + val comp = ScalaFnComponent.withHooks[PI] + .custom(hookE(10)) + .custom(hookS(3)) // <--------------------------------------- s1 + .custom(hookS.contramap[PI](_.pi)) // <---------------------- s2 + .customBy((p, s, _) => hookE(p.pi + s.value)) + .customBy($ => hookE($.props.pi + $.hook1.value + 1)) + .customBy($ => hookS($.props.pi + $.hook1.value + 1)) // <--- s3 + .renderRR((_, s1, s2, s3) => + <.div( + s"${s1.value}:${s2.value}:${s3.value}", + <.button(^.onClick --> s1.modState(_ + 1)) + ) + ) + + test(comp(PI(5))) { t => + t.assertText("3:5:9") + assertEq(counter.value, 10 + (5+3) + (5+3+1)) + counter.value = 0 + t.clickButton() + t.assertText("4:5:9") + assertEq(counter.value, 10 + (5+4) + (5+4+1)) + } + } + } diff --git a/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksRRTest.scala b/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksRRTest.scala new file mode 100644 index 000000000..c2b0c862d --- /dev/null +++ b/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksRRTest.scala @@ -0,0 +1,1347 @@ +package japgolly.scalajs.react.core + +import japgolly.scalajs.react.Hooks.UseEffectArg +import japgolly.scalajs.react._ +import japgolly.scalajs.react.extra._ +import japgolly.scalajs.react.test.DomTester +import japgolly.scalajs.react.test.ReactTestUtils._ +import japgolly.scalajs.react.test.TestUtil._ +import japgolly.scalajs.react.vdom.html_<^._ +import org.scalajs.dom.html.Input +import utest._ + +// Copy of HooksTest but using renderRR +// TODO: Remove tests that don't use renderRR +object HooksRRTest extends TestSuite { + + // TODO: https://github.com/lampepfl/dotty/issues/12663 + // Should be private ↓ + def test[M, A](u: Unmounted[M])(f: DomTester => A): A = + withRenderedIntoBody(u).withParent(root => f(new DomTester(root))) + + private val incBy1 = Reusable.byRef((_: Int) + 1) + private val incBy5 = Reusable.byRef((_: Int) + 5) + + // TODO: https://github.com/lampepfl/dotty/issues/12663 + // Should be private or moved elsewhere ↓ + final class Counter { + var value = 0 + def inc(by: Int = 1): Int = { + value += by + value + } + def incCB : Callback = incCB(1) + def incCB(by: Int): Callback = Callback{ inc(by); () } + } + + private final class Recorder[A] { + var values = Vector.empty[A] + def add(as: A*): Unit = values ++= as + def addCB(as: A*): Callback = {val x = as.toList; Callback(add(x: _*))} + } + + // TODO: https://github.com/lampepfl/dotty/issues/12663 + // Should be private ↓ + final case class PI(pi: Int) { + def unary_- : PI = PI(-pi) + def *(n: Int): PI = PI(pi * n) + def +(n: Int): PI = PI(pi + n) + def +(n: PI): PI = PI(pi + n.pi) + } + + private final class ReusableSetIntComponent { + private var renders = 0 + def render(f: Reusable[Int => Callback]) = { + renders += 1 + <.div(renders, + <.button(^.onClick --> f(1)), + <.button(^.onClick --> f(2)), + ) + } + } + private val ReusableSetIntComponent = + ScalaComponent.builder[Reusable[Int => Callback]] + .renderBackend[ReusableSetIntComponent] + .configure(Reusability.shouldComponentUpdate) + .build + + private final class ReusableModIntComponent { + private var renders = 0 + def render(f: Reusable[(Int => Int) => Callback]) = { + renders += 1 + <.div(renders, + <.button(^.onClick --> f(_ + 1)), + <.button(^.onClick --> f(_ + 10)), + ) + } + } + private val ReusableModIntComponent = + ScalaComponent.builder[Reusable[(Int => Int) => Callback]] + .renderBackend[ReusableModIntComponent] + .configure(Reusability.shouldComponentUpdate) + .build + + private final class ReusableCallbackComponent { + private var renders = 0 + def render(p: Reusable[Callback]) = { + renders += 1 + <.div(renders, <.button(^.onClick --> p)) + } + } + private val ReusableCallbackComponent = + ScalaComponent.builder[Reusable[Callback]] + .renderBackend[ReusableCallbackComponent] + .configure(Reusability.shouldComponentUpdate) + .build + + private final class ReusableStateSnapshotComponent { + private var renders = 0 + def render(s: StateSnapshot[Int]) = { + renders += 1 + <.div(s"${s.value}:$renders", + <.button(^.onClick --> s.modState(_ + 1)), + <.button(^.onClick --> s.modState(_ + 10)), + ) + } + } + private val ReusableStateSnapshotComponent = + ScalaComponent.builder[StateSnapshot[Int]] + .renderBackend[ReusableStateSnapshotComponent] + .configure(Reusability.shouldComponentUpdate) + .build + + // =================================================================================================================== + + private def testCustomHook(): Unit = { + // TODO: https://github.com/lampepfl/dotty/issues/12663 + ScalaSpecificHooksTest.testCustomHookRR() + + // val counter = new Counter + + // val hookS = CustomHook[Int].useStateBy(identity).buildReturning(_.hook1) + // val hookE = CustomHook[Int].useEffectBy(counter.incCB(_)).build + + // val comp = ScalaFnComponent.withHooks[PI] + // .custom(hookE(10)) + // .custom(hookS(3)) // <--------------------------------------- s1 + // .custom(hookS.contramap[PI](_.pi)) // <---------------------- s2 + // .customBy((p, s, _) => hookE(p.pi + s.value)) + // .customBy($ => hookS($.props.pi + $.hook1.value + 1)) // <--- s3 + // .customBy($ => hookE($.props.pi + $.hook1.value + 1)) + // .renderRR((p, s1, s2, s3) => + // <.div( + // s"${s1.value}:${s2.value}:${s3.value}", + // <.button(^.onClick --> s1.modState(_ + 1)) + // ) + // ) + + // test(comp(PI(5))) { t => + // t.assertText("3:5:9") + // assertEq(counter.value, 10 + (5+3) + (5+3+1)) + // counter.value = 0 + // t.clickButton() + // t.assertText("4:5:9") + // assertEq(counter.value, 10 + (5+4) + (5+4+1)) + // } + } + + private def testCustomHookComposition(): Unit = { + locally { + type LL = CustomHook[Long, Long] + type II = CustomHook[Int, Int] + type IU = CustomHook[Int, Unit] + type UI = CustomHook[Unit, Int] + type UU = CustomHook[Unit, Unit] + type TF = CustomHook[3, 4] + type FT = CustomHook[4, 3] + + assertType[(II, LL)].map(h => h._1 ++ h._2).is[CustomHook[(Int, Long), (Int, Long)]] + assertType[(II, TF)].map(h => h._1 ++ h._2).is[CustomHook[(Int, 3), (Int, 4)]] + assertType[(II, II)].map(h => h._1 ++ h._2).is[CustomHook[Int, (Int, Int)]] + assertType[(II, IU)].map(h => h._1 ++ h._2).is[CustomHook[Int, Int]] + assertType[(II, UI)].map(h => h._1 ++ h._2).is[CustomHook[Int, (Int, Int)]] + assertType[(II, UU)].map(h => h._1 ++ h._2).is[CustomHook[Int, Int]] + + assertType[(IU, LL)].map(h => h._1 ++ h._2).is[CustomHook[(Int, Long), Long]] + assertType[(IU, TF)].map(h => h._1 ++ h._2).is[CustomHook[(Int, 3), 4]] + assertType[(IU, II)].map(h => h._1 ++ h._2).is[CustomHook[Int, Int]] + assertType[(IU, IU)].map(h => h._1 ++ h._2).is[CustomHook[Int, Unit]] + assertType[(IU, UI)].map(h => h._1 ++ h._2).is[CustomHook[Int, Int]] + assertType[(IU, UU)].map(h => h._1 ++ h._2).is[CustomHook[Int, Unit]] + + assertType[(UI, LL)].map(h => h._1 ++ h._2).is[CustomHook[Long, (Int, Long)]] + assertType[(UI, TF)].map(h => h._1 ++ h._2).is[CustomHook[3, (Int, 4)]] + assertType[(UI, II)].map(h => h._1 ++ h._2).is[CustomHook[Int, (Int, Int)]] + assertType[(UI, IU)].map(h => h._1 ++ h._2).is[CustomHook[Int, Int]] + assertType[(UI, UI)].map(h => h._1 ++ h._2).is[CustomHook[Unit, (Int, Int)]] + assertType[(UI, UU)].map(h => h._1 ++ h._2).is[CustomHook[Unit, Int]] + + assertType[(UU, LL)].map(h => h._1 ++ h._2).is[CustomHook[Long, Long]] + assertType[(UU, TF)].map(h => h._1 ++ h._2).is[CustomHook[3, 4]] + assertType[(UU, II)].map(h => h._1 ++ h._2).is[CustomHook[Int, Int]] + assertType[(UU, IU)].map(h => h._1 ++ h._2).is[CustomHook[Int, Unit]] + assertType[(UU, UI)].map(h => h._1 ++ h._2).is[CustomHook[Unit, Int]] + assertType[(UU, UU)].map(h => h._1 ++ h._2).is[CustomHook[Unit, Unit]] + + assertType[(LL, LL)].map(h => h._1 ++ h._2).is[CustomHook[Long, (Long, Long)]] + assertType[(LL, II)].map(h => h._1 ++ h._2).is[CustomHook[(Long, Int), (Long, Int)]] + assertType[(LL, IU)].map(h => h._1 ++ h._2).is[CustomHook[(Long, Int), Long]] + assertType[(LL, UI)].map(h => h._1 ++ h._2).is[CustomHook[Long, (Long, Int)]] + assertType[(LL, UU)].map(h => h._1 ++ h._2).is[CustomHook[Long, Long]] + + assertType[(TF, FT)].map(h => h._1 ++ h._2).is[CustomHook[(3, 4), (4, 3)]] + assertType[(TF, II)].map(h => h._1 ++ h._2).is[CustomHook[(3, Int), (4, Int)]] + assertType[(TF, IU)].map(h => h._1 ++ h._2).is[CustomHook[(3, Int), 4]] + assertType[(TF, LL)].map(h => h._1 ++ h._2).is[CustomHook[(3, Long), (4, Long)]] + assertType[(TF, TF)].map(h => h._1 ++ h._2).is[CustomHook[3, 4]] + assertType[(TF, UI)].map(h => h._1 ++ h._2).is[CustomHook[3, (4, Int)]] + assertType[(TF, UU)].map(h => h._1 ++ h._2).is[CustomHook[3, 4]] + + assertType[(FT, FT)].map(h => h._1 ++ h._2).is[CustomHook[4, 3]] + assertType[(FT, II)].map(h => h._1 ++ h._2).is[CustomHook[(4, Int), (3, Int)]] + assertType[(FT, IU)].map(h => h._1 ++ h._2).is[CustomHook[(4, Int), 3]] + assertType[(FT, LL)].map(h => h._1 ++ h._2).is[CustomHook[(4, Long), (3, Long)]] + assertType[(FT, TF)].map(h => h._1 ++ h._2).is[CustomHook[(4, 3), (3, 4)]] + assertType[(FT, UI)].map(h => h._1 ++ h._2).is[CustomHook[4, (3, Int)]] + assertType[(FT, UU)].map(h => h._1 ++ h._2).is[CustomHook[4, 3]] + } + + val ints = new Recorder[Int] + + val addII = CustomHook[Int].useEffectBy(ints.addCB(_)).buildReturning(identity) + val addI_ = addII.map(_ => ()).contramap[Int](_ * 10) + val add_S = CustomHook[Unit].useEffect(ints.addCB(100)).buildReturning(_ => "ah") + + val hook = addII ++ addI_ ++ add_S + val _ : CustomHook[Int, (Int, String)] = hook + + val comp = ScalaFnComponent.withHooks[PI] + .customBy(p => hook(p.pi)) + .renderRR((_, h) => h.toString) + + test(comp(PI(3))) { t => + t.assertText("(3,ah)") + } + assertEq(ints.values, Vector(3, 30, 100)) + } + + private def testLazyVal(): Unit = { + val counter = new Counter + val comp = ScalaFnComponent.withHooks[PI] + .localLazyVal(counter.inc()) + .localLazyValBy((p, _) => p.pi + counter.inc()) + .localLazyValBy($ => $.props.pi + counter.inc()) + .useState(123) + .renderRR { (p, f1, f2, f3, s) => + val v3 = f3() + val v2 = f2() + val v1 = f1() + <.div( + <.div(s"P=$p, v1=$v1, v2=$v2, v3=$v3"), + <.button(^.onClick --> s.modState(_ + 1))) + } + + test(comp(PI(10))) { t => + t.assertText("P=PI(10), v1=3, v2=12, v3=11") + t.clickButton(); t.assertText("P=PI(10), v1=6, v2=15, v3=14") + } + } + + private def testVal(): Unit = { + val counter = new Counter + val comp = ScalaFnComponent.withHooks[PI] + .localVal(counter.inc()) + .localValBy((p, _) => p.pi + counter.inc()) + .localValBy($ => $.props.pi + counter.inc()) + .useState(123) + .renderRR { (p, v1, v2, v3, s) => + <.div( + <.div(s"P=$p, v1=$v1, v2=$v2, v3=$v3"), + <.button(^.onClick --> s.modState(_ + 1))) + } + + test(comp(PI(10))) { t => + t.assertText("P=PI(10), v1=1, v2=12, v3=13") + t.clickButton(); t.assertText("P=PI(10), v1=4, v2=15, v3=16") + } + } + + private def testVar(): Unit = { + val counter = new Counter + val comp = ScalaFnComponent.withHooks[PI] + .localVar(counter.inc()) + .localVarBy((p, _) => p.pi + counter.inc()) + .localVarBy($ => $.props.pi + counter.inc()) + .useState(123) + .renderRR { (p, v1, v2, v3, s) => + v1.value += 100 + v2.value += 100 + v3.value += 100 + <.div( + <.div(s"P=$p, v1=${v1.value}, v2=${v2.value}, v3=${v3.value}"), + <.button(^.onClick --> s.modState(_ + 1))) + } + + test(comp(PI(10))) { t => + t.assertText("P=PI(10), v1=101, v2=112, v3=113") + t.clickButton(); t.assertText("P=PI(10), v1=104, v2=115, v3=116") + } + } + + private def testUnchecked(): Unit = { + val counterE = new Counter + val counterS = new Counter + + val comp = ScalaFnComponent.withHooks[PI] + .unchecked{counterE.inc(10); ()} + .unchecked(counterS.inc(3)) + .uncheckedBy((p, _) => counterS.inc(p.pi)) + .uncheckedBy((p, s, _) => {counterE.inc(p.pi + s); ()}) + .uncheckedBy($ => counterS.inc($.props.pi + $.hook1 + 1)) + .uncheckedBy($ => {counterE.inc($.props.pi + $.hook1 + 1); ()}) + .useState(0) + .renderRR((_, s1, s2, s3, x) => + <.div( + s"$s1:$s2:$s3", + <.button(^.onClick --> x.modState(_ + 1)) + ) + ) + + test(comp(PI(5))) { t => + t.assertText("3:8:17") + assertEq(counterE.value, 10 + (5+3) + (5+3+1)) + counterE.value = 0 + t.clickButton() + t.assertText("20:25:51") // +3 : +5 : +(5+20+1) + assertEq(counterE.value, 10 + (5+20) + (5+20+1)) + } + } + + private def testUseCallback(): Unit = { + val counter = new Counter + val comp = ScalaFnComponent.withHooks[Unit] + .useCallback(counter.incCB(9)) + .useCallback((i: Int) => counter.incCB(i)) + .useState(0) + .renderRR((_, c1, c2, s) => + <.div( + "S=", counter.value, + ", R1=", ReusableCallbackComponent(c1), + ", R2=", ReusableSetIntComponent(c2), + <.button(^.onClick --> s.modState(_ + 1)) + ) + ) + + val inc9 = 1 + val inc1 = 2 + val inc2 = 3 + val rndr = 4 + + test(comp()) { t => + assertEq(counter.value, 0); t.assertText("S=0, R1=1, R2=1") + t.clickButton(inc1); assertEq(counter.value, 1); t.assertText("S=0, R1=1, R2=1") + t.clickButton(inc9); assertEq(counter.value, 10); t.assertText("S=0, R1=1, R2=1") + t.clickButton(inc2); assertEq(counter.value, 12); t.assertText("S=0, R1=1, R2=1") + t.clickButton(rndr); assertEq(counter.value, 12); t.assertText("S=12, R1=1, R2=1") + } + } + + private def testUseCallbackBy(): Unit = { + val counter = new Counter + val comp = ScalaFnComponent.withHooks[PI] + .useCallbackBy(p => counter.incCB(p.pi)) + .useCallbackBy((_, c1) => (i: Int) => c1 >> counter.incCB(i)) + .useCallbackBy($ => (i: Int) => $.hook1 >> counter.incCB(2 + i)) + .useState(0) + .renderRR((_, c1, c2, c3, s) => + <.div( + "S=", counter.value, + ", R1=", ReusableCallbackComponent(c1), + ", R2=", ReusableSetIntComponent(c2), + ", R3=", ReusableSetIntComponent(c3), + <.button(^.onClick --> s.modState(_ + 1)) + ) + ) + + val inc7 = 1 + val inc8 = 2 // 7 + 1 + val inc9 = 3 // 7 + 2 + val inc10 = 4 // 7 + 2 + 1 + val inc11 = 5 // 7 + 2 + 2 + val rndr = 6 + + test(comp(PI(7))) { t => + assertEq(counter.value, 0); t.assertText("S=0, R1=1, R2=1, R3=1") + t.clickButton(inc9); assertEq(counter.value, 9); t.assertText("S=0, R1=1, R2=1, R3=1") + t.clickButton(inc11); assertEq(counter.value, 20); t.assertText("S=0, R1=1, R2=1, R3=1") + t.clickButton(inc10); assertEq(counter.value, 30); t.assertText("S=0, R1=1, R2=1, R3=1") + t.clickButton(inc8); assertEq(counter.value, 38); t.assertText("S=0, R1=1, R2=1, R3=1") + t.clickButton(inc7); assertEq(counter.value, 45); t.assertText("S=0, R1=1, R2=1, R3=1") + t.clickButton(rndr); assertEq(counter.value, 45); t.assertText("S=45, R1=1, R2=1, R3=1") + } + } + + private def testUseCallbackWithDeps(): Unit = { + val depA = new Counter + val depB = new Counter + val counter = new Counter + val comp = ScalaFnComponent.withHooks[Unit] + .useCallbackWithDeps(depA.value)(_ => counter.incCB(depA.value)) + .useCallbackWithDeps(depB.value)(_ => (i: Int) => counter.incCB(depB.value + i - 1)) + .useState(0) + .renderRR((_, c1, c2, s) => + <.div( + "S=", counter.value, + ", R1=", ReusableCallbackComponent(c1), + ", R2=", ReusableSetIntComponent(c2), + <.button(^.onClick --> s.modState(_ + 1)) + ) + ) + + val incA = 1 + val incB0 = 2 + val incB1 = 3 + val rndr = 4 + + depA.value = 10 + depB.value = 20 + test(comp()) { t => + assertEq(counter.value, 0); t.assertText("S=0, R1=1, R2=1") + t.clickButton(incA); assertEq(counter.value, 10); t.assertText("S=0, R1=1, R2=1") + t.clickButton(incB0); assertEq(counter.value, 30); t.assertText("S=0, R1=1, R2=1") + t.clickButton(incB1); assertEq(counter.value, 51); t.assertText("S=0, R1=1, R2=1") + t.clickButton(rndr); assertEq(counter.value, 51); t.assertText("S=51, R1=1, R2=1") + depA.value = 100; t.clickButton(rndr); assertEq(counter.value, 51); t.assertText("S=51, R1=2, R2=1") + t.clickButton(incA); assertEq(counter.value, 151); t.assertText("S=51, R1=2, R2=1") + t.clickButton(incB0); assertEq(counter.value, 171); t.assertText("S=51, R1=2, R2=1") + depB.value = 200; t.clickButton(rndr); assertEq(counter.value, 171); t.assertText("S=171, R1=2, R2=2") + t.clickButton(incB1); assertEq(counter.value, 372); t.assertText("S=171, R1=2, R2=2") + } + } + + private def testUseCallbackWithDepsBy(): Unit = { + val counter = new Counter + val comp = ScalaFnComponent.withHooks[PI] + .useCallbackWithDepsBy(_.pi)(p => _ => counter.incCB(p.pi)) // hook1 + .useState(10) // hook2: dep1 + .useState(20) // hook3: dep2 + .useCallbackWithDepsBy((_, _, d1, _) => d1.value)((_, _, _, _) => counter.incCB) // hook4 + .useCallbackWithDepsBy(_.hook3.value)($ => _ => (i: Int) => counter.incCB($.hook3.value + i - 1)) // hook5 + .renderRR((_, c0, d1, d2, c1, c2) => + <.div( + "S=", counter.value, + ", C0=", ReusableCallbackComponent(c0), + ", C1=", ReusableCallbackComponent(c1), + ", C2=", ReusableSetIntComponent(c2), + <.button(^.onClick --> d1.modState(_ + 100)), + <.button(^.onClick --> d2.modState(_ + 100)), + ) + ) + + val c0 = 1 // s += 3 + val c1 = 2 // s += d1 + val c2a = 3 // s += d2 + val c2b = 4 // s += d2+1 + val d1 = 5 // d1 += 100 + val d2 = 6 // d2 += 100 + + test(comp(PI(3))) { t => + assertEq(counter.value, 0); t.assertText("S=0, C0=1, C1=1, C2=1") + t.clickButton(c1); assertEq(counter.value, 10); t.assertText("S=0, C0=1, C1=1, C2=1") + t.clickButton(c0); assertEq(counter.value, 13); t.assertText("S=0, C0=1, C1=1, C2=1") + t.clickButton(c2b); assertEq(counter.value, 34); t.assertText("S=0, C0=1, C1=1, C2=1") + t.clickButton(c2a); assertEq(counter.value, 54); t.assertText("S=0, C0=1, C1=1, C2=1") + t.clickButton(d2); assertEq(counter.value, 54); t.assertText("S=54, C0=1, C1=1, C2=2") // d2=120 + t.clickButton(c2a); assertEq(counter.value, 174); t.assertText("S=54, C0=1, C1=1, C2=2") + t.clickButton(c0); assertEq(counter.value, 177); t.assertText("S=54, C0=1, C1=1, C2=2") + t.clickButton(c1); assertEq(counter.value, 187); t.assertText("S=54, C0=1, C1=1, C2=2") + t.clickButton(d1); assertEq(counter.value, 187); t.assertText("S=187, C0=1, C1=2, C2=2") // d1=110 + t.clickButton(c2a); assertEq(counter.value, 307); t.assertText("S=187, C0=1, C1=2, C2=2") + t.clickButton(c1); assertEq(counter.value, 417); t.assertText("S=187, C0=1, C1=2, C2=2") + t.clickButton(d1); assertEq(counter.value, 417); t.assertText("S=417, C0=1, C1=3, C2=2") // d1=210 + t.clickButton(d1); assertEq(counter.value, 417); t.assertText("S=417, C0=1, C1=4, C2=2") // d1=310 + t.clickButton(c1); assertEq(counter.value, 727); t.assertText("S=417, C0=1, C1=4, C2=2") + } + } + + private def testUseContext(): Unit = { + val ctx = React.createContext(100) + + val compC = ScalaFnComponent.withHooks[Unit] + .useContext(ctx) + .renderRR((_, c) => c) + + val comp = ScalaFnComponent[Unit] { _ => + <.div( + compC(), + ":", + ctx.provide(123)(compC()), + ) + } + + test(comp()) { t => + t.assertText("100:123") + } + } + + // Can't really observe this but can at least confirm that usage doesn't throw + // private def testUseDebugValue(): Unit = { + // val comp = ScalaFnComponent.withHooks[PI] + // .useDebugValue("hehe") + // .useDebugValueBy(_.pi) + // .useState(0) + // .useDebugValueBy($ => $.props.pi + $.hook1.value) + // .renderRR($ => <.div($.props.pi)) + + // test(comp(PI(3))) { t => + // t.assertText("3") + // } + // } + + trait X_UseEffect_Primary[Ctx, Step <: HooksApi.AbstractStep] { + def X_useEffect[A](effect: A)(implicit a: UseEffectArg[A], step: Step): step.Self + def X_useEffectBy[A](init: Ctx => A)(implicit a: UseEffectArg[A], step: Step): step.Self + def X_useEffectOnMount[A](effect: A)(implicit a: UseEffectArg[A], step: Step): step.Self + def X_useEffectOnMountBy[A](effect: Ctx => A)(implicit a: UseEffectArg[A], step: Step): step.Self + def X_useEffectWithDeps[D, A](deps: => D)(effect: D => A)(implicit a: UseEffectArg[A], r: Reusability[D], step: Step): step.Self + def X_useEffectWithDepsBy[D, A](deps: Ctx => D)(effect: Ctx => D => A)(implicit a: UseEffectArg[A], r: Reusability[D], step: Step): step.Self + } + trait X_UseEffect_Secondary[Ctx, CtxFn[_], Step <: HooksApi.SubsequentStep[Ctx, CtxFn]] extends X_UseEffect_Primary[Ctx, Step] { + def X_useEffectBy[A](init: CtxFn[A])(implicit a: UseEffectArg[A], step: Step): step.Self + def X_useEffectOnMountBy[A](effect: CtxFn[A])(implicit a: UseEffectArg[A], step: Step): step.Self + def X_useEffectWithDepsBy[D, A](deps: CtxFn[D])(effect: CtxFn[D => A])(implicit a: UseEffectArg[A], r: Reusability[D], step: Step): step.Self + } + + private object UseEffect extends UseEffectTests { + override protected implicit def hooksExt1[Ctx, Step <: HooksApi.AbstractStep](api: HooksApi.Primary[Ctx, Step]) = + new Primary(api) + override protected implicit def hooksExt2[Ctx, CtxFn[_], Step <: HooksApi.SubsequentStep[Ctx, CtxFn]](api: HooksApi.Secondary[Ctx, CtxFn, Step]) = + new Secondary(api) + protected class Primary[Ctx, Step <: HooksApi.AbstractStep](api: HooksApi.Primary[Ctx, Step]) extends X_UseEffect_Primary[Ctx, Step] { + override def X_useEffect[A](effect: A)(implicit a: UseEffectArg[A], step: Step) = + api.useEffect(effect) + override def X_useEffectBy[A](init: Ctx => A)(implicit a: UseEffectArg[A], step: Step) = + api.useEffectBy(init) + override def X_useEffectOnMount[A](effect: A)(implicit a: UseEffectArg[A], step: Step) = + api.useEffectOnMount(effect) + override def X_useEffectOnMountBy[A](effect: Ctx => A)(implicit a: UseEffectArg[A], step: Step) = + api.useEffectOnMountBy(effect) + override def X_useEffectWithDeps[D, A](deps: => D)(effect: D => A)(implicit a: UseEffectArg[A], r: Reusability[D], step: Step) = + api.useEffectWithDeps(deps)(effect) + override def X_useEffectWithDepsBy[D, A](deps: Ctx => D)(effect: Ctx => D => A)(implicit a: UseEffectArg[A], r: Reusability[D], step: Step) = + api.useEffectWithDepsBy(deps)(effect) + } + protected class Secondary[Ctx, CtxFn[_], Step <: HooksApi.SubsequentStep[Ctx, CtxFn]](api: HooksApi.Secondary[Ctx, CtxFn, Step]) extends Primary(api) with X_UseEffect_Secondary[Ctx, CtxFn, Step] { + override def X_useEffectBy[A](init: CtxFn[A])(implicit a: UseEffectArg[A], step: Step): step.Self = + api.useEffectBy(init) + override def X_useEffectOnMountBy[A](effect: CtxFn[A])(implicit a: UseEffectArg[A], step: Step): step.Self = + api.useEffectOnMountBy(effect) + override def X_useEffectWithDepsBy[D, A](deps: CtxFn[D])(effect: CtxFn[D => A])(implicit a: UseEffectArg[A], r: Reusability[D], step: Step): step.Self = + api.useEffectWithDepsBy(deps)(effect) + } + } + + private object UseLayoutEffect extends UseEffectTests { + override protected implicit def hooksExt1[Ctx, Step <: HooksApi.AbstractStep](api: HooksApi.Primary[Ctx, Step]) = + new Primary(api) + override protected implicit def hooksExt2[Ctx, CtxFn[_], Step <: HooksApi.SubsequentStep[Ctx, CtxFn]](api: HooksApi.Secondary[Ctx, CtxFn, Step]) = + new Secondary(api) + protected class Primary[Ctx, Step <: HooksApi.AbstractStep](api: HooksApi.Primary[Ctx, Step]) extends X_UseEffect_Primary[Ctx, Step] { + override def X_useEffect[A](effect: A)(implicit a: UseEffectArg[A], step: Step) = + api.useLayoutEffect(effect) + override def X_useEffectBy[A](init: Ctx => A)(implicit a: UseEffectArg[A], step: Step) = + api.useLayoutEffectBy(init) + override def X_useEffectOnMount[A](effect: A)(implicit a: UseEffectArg[A], step: Step) = + api.useLayoutEffectOnMount(effect) + override def X_useEffectOnMountBy[A](effect: Ctx => A)(implicit a: UseEffectArg[A], step: Step) = + api.useLayoutEffectOnMountBy(effect) + override def X_useEffectWithDeps[D, A](deps: => D)(effect: D => A)(implicit a: UseEffectArg[A], r: Reusability[D], step: Step) = + api.useLayoutEffectWithDeps(deps)(effect) + override def X_useEffectWithDepsBy[D, A](deps: Ctx => D)(effect: Ctx => D => A)(implicit a: UseEffectArg[A], r: Reusability[D], step: Step) = + api.useLayoutEffectWithDepsBy(deps)(effect) + } + protected class Secondary[Ctx, CtxFn[_], Step <: HooksApi.SubsequentStep[Ctx, CtxFn]](api: HooksApi.Secondary[Ctx, CtxFn, Step]) extends Primary(api) with X_UseEffect_Secondary[Ctx, CtxFn, Step] { + override def X_useEffectBy[A](init: CtxFn[A])(implicit a: UseEffectArg[A], step: Step): step.Self = + api.useLayoutEffectBy(init) + override def X_useEffectOnMountBy[A](effect: CtxFn[A])(implicit a: UseEffectArg[A], step: Step): step.Self = + api.useLayoutEffectOnMountBy(effect) + override def X_useEffectWithDepsBy[D, A](deps: CtxFn[D])(effect: CtxFn[D => A])(implicit a: UseEffectArg[A], r: Reusability[D], step: Step): step.Self = + api.useLayoutEffectWithDepsBy(deps)(effect) + } + } + + private abstract class UseEffectTests { + protected implicit def hooksExt1[Ctx, Step <: HooksApi.AbstractStep](api: HooksApi.Primary[Ctx, Step]): X_UseEffect_Primary[Ctx, Step] + protected implicit def hooksExt2[Ctx, CtxFn[_], Step <: HooksApi.SubsequentStep[Ctx, CtxFn]](api: HooksApi.Secondary[Ctx, CtxFn, Step]): X_UseEffect_Secondary[Ctx, CtxFn, Step] + + def testConst(): Unit = { + val counter1 = new Counter + val counter2 = new Counter + def state() = s"${counter1.value}:${counter2.value}" + + val comp = ScalaFnComponent.withHooks[Unit] + .X_useEffect(counter1.incCB.ret(counter2.incCB)) + .X_useEffect(counter1.incCB(101)) + .X_useEffect(counter1.incCB.ret(counter2.incCB)) + .useState(321) + .renderRR((_, s) => <.button(^.onClick --> s.modState(_ + 1))) + + test(comp()) { t => + assertEq(state(), "103:0") + t.clickButton(); assertEq(state(), "206:2") + } + assertEq(state(), "206:4") + } + + def testConstBy(): Unit = { + val counter1 = new Counter + val counter2 = new Counter + def state() = s"${counter1.value}:${counter2.value}" + val comp = ScalaFnComponent.withHooks[Unit] + .useState(100) + .X_useEffectBy((_, s1) => counter1.incCB(s1.value)) + .X_useEffectBy($ => counter1.incCB.ret(counter2.incCB($.hook1.value))) + .renderRR((_, s) => <.button(^.onClick --> s.modState(_ + 1))) + + test(comp()) { t => + assertEq(state(), "101:0") + t.clickButton(); assertEq(state(), "203:100") + } + assertEq(state(), "203:201") + } + + def testOnMount(): Unit = { + val counter1 = new Counter + val counter2 = new Counter + def state() = s"${counter1.value}:${counter2.value}" + val comp = ScalaFnComponent.withHooks[Unit] + .X_useEffectOnMount(counter1.incCB.ret(counter2.incCB)) + .X_useEffectOnMount(counter1.incCB(101)) + .X_useEffectOnMount(counter1.incCB.ret(counter2.incCB)) + .useState(321) + .renderRR((_, s) => <.button(^.onClick --> s.modState(_ + 1))) + + test(comp()) { t => + assertEq(state(), "103:0") + t.clickButton(); assertEq(state(), "103:0") + } + assertEq(state(), "103:2") + } + + def testOnMountBy(): Unit = { + val counter1 = new Counter + val counter2 = new Counter + def state() = s"${counter1.value}:${counter2.value}" + val comp = ScalaFnComponent.withHooks[Unit] + .useState(100) + .X_useEffectOnMountBy((_, s1) => counter1.incCB(s1.value)) + .X_useEffectOnMountBy($ => counter1.incCB.ret(counter2.incCB($.hook1.value))) + .renderRR((_, s) => <.button(^.onClick --> s.modState(_ + 1))) + + test(comp()) { t => + assertEq(state(), "101:0") + t.clickButton(); assertEq(state(), "101:0") + } + assertEq(state(), "101:100") + } + + def testWithDeps(): Unit = { + val dep1 = new Counter + val dep2 = new Counter + val dep3 = new Counter + val counter1 = new Counter + val counter2 = new Counter + def state() = s"${counter1.value}:${counter2.value}" + val comp = ScalaFnComponent.withHooks[Unit] + .X_useEffectWithDeps(dep1.value)(_ => counter1.incCB.ret(counter2.incCB)) + .X_useEffectWithDeps(dep2.value)(_ => counter1.incCB(100)) + .X_useEffectWithDeps(dep3.value)(_ => counter1.incCB(10).ret(counter2.incCB(10))) + .useState(321) + .renderRR((_, s) => <.button(^.onClick --> s.modState(_ + 1))) + + test(comp()) { t => + assertEq(state(), "111:0") + t.clickButton(); assertEq(state(), "111:0") + dep2.inc(); t.clickButton(); assertEq(state(), "211:0") + dep1.inc(); t.clickButton(); assertEq(state(), "212:1") + dep1.inc(); t.clickButton(); assertEq(state(), "213:2") + dep3.inc(); t.clickButton(); assertEq(state(), "223:12") + } + assertEq(state(), "223:23") + } + + def testWithDepsBy(): Unit = { + var _state = -1 + val dep1 = new Counter + val dep2 = new Counter + val dep3 = new Counter + val counter1 = new Counter + val counter2 = new Counter + def state() = s"${_state})${counter1.value}:${counter2.value}" + + val comp = ScalaFnComponent.withHooks[PI] + .X_useEffectWithDepsBy(_ => dep1.value)(p => _ => counter1.incCB(p.pi).ret(counter2.incCB(p.pi))) + .useState(100) + .X_useEffectWithDepsBy((_, _) => dep2.value)((_, s) => _ => counter1.incCB(s.value)) + .X_useEffectWithDepsBy(_ => dep3.value)($ => _ => counter1.incCB($.hook1.value / 10).ret(counter2.incCB($.hook1.value / 10))) + .renderRR((_, s) => { + _state = s.value + <.button(^.onClick --> s.modState(_ + 100)) + }) + + test(comp(PI(1000))) { t => + assertEq(state(), "100)1110:0") + t.clickButton(); assertEq(state(), "200)1110:0") + dep2.inc(); t.clickButton(); assertEq(state(), "300)1410:0") + dep1.inc(); t.clickButton(); assertEq(state(), "400)2410:1000") + dep1.inc(); t.clickButton(); assertEq(state(), "500)3410:2000") + dep3.inc(); t.clickButton(); assertEq(state(), "600)3470:2010") // s'=100, d'=10, s=600, d=60 + dep3.inc(); t.clickButton(); assertEq(state(), "700)3540:2070") // s'=600, d'=60, s=700, d=70 + } + assertEq(state(), "700)3540:3140") // +1000 +0 +70 + } + + } // UseEffectTests + + private def testUseForceUpdate(): Unit = { + val counter = new Counter + val comp = ScalaFnComponent.withHooks[Unit] + .useForceUpdate + .renderRR { (_, forceUpdate) => + val rev = counter.inc() + <.div( + rev, ":", ReusableCallbackComponent(forceUpdate) + ) + } + + test(comp()) { t => + t.assertText("1:1") + t.clickButton(); t.assertText("2:2") + t.clickButton(); t.assertText("3:3") + } + } + + private def testUseMemo(): Unit = { + val dep1 = new Counter + val dep2 = new Counter + val counter = new Counter + + val comp = ScalaFnComponent.withHooks[Unit] + .useMemo(dep1.value)(counter.incCB) + .useMemo(dep2.value)(counter.incCB) + .useState(0) + .renderRR((_, c1, c2, s) => + <.div( + "C1=", ReusableCallbackComponent(c1), + ", C2=", ReusableCallbackComponent(c2), + <.button(^.onClick --> s.modState(_ + 1)), + ) + ) + + val c1 = 1 + val c2 = 2 + val s = 3 + + dep1.value = 1 + dep2.value = 10 + test(comp()) { t => + assertEq(counter.value, 0); t.assertText("C1=1, C2=1") + t.clickButton(c2); assertEq(counter.value, 10); t.assertText("C1=1, C2=1") + t.clickButton(c2); assertEq(counter.value, 20); t.assertText("C1=1, C2=1") + t.clickButton(c1); assertEq(counter.value, 21); t.assertText("C1=1, C2=1") + t.clickButton(s); assertEq(counter.value, 21); t.assertText("C1=1, C2=1") + t.clickButton(s); assertEq(counter.value, 21); t.assertText("C1=1, C2=1") + dep1.value = 17; t.clickButton(s); assertEq(counter.value, 21); t.assertText("C1=2, C2=1") + dep1.value = 7; t.clickButton(s); assertEq(counter.value, 21); t.assertText("C1=3, C2=1") + t.clickButton(c2); assertEq(counter.value, 31); t.assertText("C1=3, C2=1") + t.clickButton(c1); assertEq(counter.value, 38); t.assertText("C1=3, C2=1") + t.clickButton(s); assertEq(counter.value, 38); t.assertText("C1=3, C2=1") + dep2.value = 100; t.clickButton(s); assertEq(counter.value, 38); t.assertText("C1=3, C2=2") + t.clickButton(c2); assertEq(counter.value, 138); t.assertText("C1=3, C2=2") + t.clickButton(s); assertEq(counter.value, 138); t.assertText("C1=3, C2=2") + t.clickButton(c1); assertEq(counter.value, 145); t.assertText("C1=3, C2=2") + } + } + + private def testUseMemoBy(): Unit = { + val counter = new Counter + val comp = ScalaFnComponent.withHooks[PI] + .useMemoBy(_.pi)(p => _ => counter.incCB(p.pi)) + .useState(1) + .useMemoBy((_, _, s) => s.value)((_, _, s) => _ => counter.incCB(s.value)) + .useState(5) + .useMemoBy($ => $.props.pi + $.hook4.value)(_ => counter.incCB) + .renderRR((_, c1, s2, c2, s3, c3) => + <.div( + "S2=", s2.value, + ", S3=", s3.value, + ", C1=", ReusableCallbackComponent(c1), + ", C2=", ReusableCallbackComponent(c2), + ", C3=", ReusableCallbackComponent(c3), + <.button(^.onClick --> s2.modState(_ + 1)), + <.button(^.onClick --> s3.modState(_ + 1)), + ) + ) + + val c1 = 1 // + p + val c2 = 2 // + s2 + val c3 = 3 // + p + s3 + val s2 = 4 + val s3 = 5 + + test(comp(PI(10))) { t => + assertEq(counter.value, 0); t.assertText("S2=1, S3=5, C1=1, C2=1, C3=1") + t.clickButton(c2); assertEq(counter.value, 1); t.assertText("S2=1, S3=5, C1=1, C2=1, C3=1") + t.clickButton(c1); assertEq(counter.value, 11); t.assertText("S2=1, S3=5, C1=1, C2=1, C3=1") + t.clickButton(c3); assertEq(counter.value, 26); t.assertText("S2=1, S3=5, C1=1, C2=1, C3=1") + t.clickButton(s2); assertEq(counter.value, 26); t.assertText("S2=2, S3=5, C1=1, C2=2, C3=1") + t.clickButton(c2); assertEq(counter.value, 28); t.assertText("S2=2, S3=5, C1=1, C2=2, C3=1") + t.clickButton(s3); assertEq(counter.value, 28); t.assertText("S2=2, S3=6, C1=1, C2=2, C3=2") + t.clickButton(c3); assertEq(counter.value, 44); t.assertText("S2=2, S3=6, C1=1, C2=2, C3=2") + } + } + + private def testUseRefManual(): Unit = { + val comp = ScalaFnComponent.withHooks[Unit] + .useRef(100) + .useState(0) + .renderRR { (_, ref, s) => + <.div( + ref.value, + <.button(^.onClick --> ref.mod(_ + 1)), + <.button(^.onClick --> s.modState(_ + 1)), + ) + } + + test(comp()) { t => + t.assertText("100") + t.clickButton(1); t.assertText("100") + t.clickButton(2); t.assertText("101") + t.clickButton(1); t.assertText("101") + t.clickButton(2); t.assertText("102") + } + } + + private def testUseRefManualBy(): Unit = { + val comp = ScalaFnComponent.withHooks[PI] + .useRefBy(_.pi + 1) + .useRefBy($ => $.props.pi + $.hook1.value) + .useState(0) + .renderRR { (_, ref1, ref2, s) => + <.div( + s"${ref1.value}:${ref2.value}", + <.button(^.onClick --> ref1.mod(_ + 1)), + <.button(^.onClick --> ref2.mod(_ + 1)), + <.button(^.onClick --> s.modState(_ + 1)), + ) + } + + test(comp(PI(4))) { t => + t.assertText("5:9") + t.clickButton(1); t.assertText("5:9") + t.clickButton(3); t.assertText("6:9") + t.clickButton(2); t.assertText("6:9") + t.clickButton(3); t.assertText("6:10") + } + } + + private def testUseRefVdom(): Unit = { + var text = "uninitialised" + val comp = ScalaFnComponent.withHooks[Unit] + .useRefToVdom[Input] + .useState("x") + .renderRR { (_, inputRef, s) => + + def onChange(e: ReactEventFromInput): Callback = + s.setState(e.target.value) + + def btn: Callback = + for { + i <- inputRef.get.asCBO + // _ <- Callback.log(s"i.value = [${i.value}]") + } yield { + text = i.value + } + + <.div( + <.input.text.withRef(inputRef)(^.value := s.value, ^.onChange ==> onChange), + <.button(^.onClick --> btn) + ) + } + + test(comp()) { t => + t.assertInputText("x") + t.clickButton() + assertEq(text, "x") + + t.setInputText("hehe") + t.assertInputText("hehe") + t.clickButton() + assertEq(text, "hehe") + } + } + + private def testUseReducer(): Unit = { + def add(n: Int): (Int, Int) => Int = _ + _ + n + val comp = ScalaFnComponent.withHooks[PI] + .useReducer(add(0), 100) + .useReducerBy((_, s1) => add(s1.value), (p, s1) => p.pi + s1.value) + .useReducerBy($ => add($.hook1.value), $ => $.props.pi + $.hook1.value + $.hook2.value) + .renderRR((p, s1, s2, s3) => + <.div( + <.div(s"P=$p, s1=${s1.value}, s2=${s2.value}, s3=${s3.value}"), + <.button(^.onClick --> s1.dispatch(1)), + <.button(^.onClick --> s2.dispatch(10)), + <.button(^.onClick --> s3.dispatch(100)), + )) + + test(comp(PI(666))) { t => + t.assertText("P=PI(666), s1=100, s2=766, s3=1532") + t.clickButton(1); t.assertText("P=PI(666), s1=101, s2=766, s3=1532") + t.clickButton(2); t.assertText("P=PI(666), s1=101, s2=877, s3=1532") // +101+10 + t.clickButton(3); t.assertText("P=PI(666), s1=101, s2=877, s3=1733") // +101+100 + } + } + + private def testUseState(): Unit = { + val comp = ScalaFnComponent.withHooks[PI] + .useState(100) + .useStateBy((p, s1) => p.pi + s1.value) + .useStateBy($ => $.props.pi + $.hook1.value + $.hook2.value) + .renderRR((p, s1, s2, s3) => + <.div( + <.div(s"P=$p, s1=${s1.value}, s2=${s2.value}, s3=${s3.value}"), + <.button(^.onClick --> ( + s1.modState(_ + 1) >> s2.modState(-_) >> s3.modState(_ * 10) + )))) + + test(comp(PI(666))) { t => + t.assertText("P=PI(666), s1=100, s2=766, s3=1532") + t.clickButton(); t.assertText("P=PI(666), s1=101, s2=-766, s3=15320") + } + } + + private def testUseStateSetStateReusability(): Unit = { + val comp = ScalaFnComponent.withHooks[Unit] + .useState(4) + .renderRR { (_, s) => + <.div( + s"S=${s.value}", + ", R1=", ReusableSetIntComponent(s.setState), + ", R2=", ReusableSetIntComponent(s.setState), + ", R3=", ReusableCallbackComponent(s.withReusableInputs.setState(Reusable.implicitly(if (s.value >= 30) -30 else 30))), + ", R4=", ReusableCallbackComponent(s.withReusableInputs.setState(Reusable.implicitly(40))), + ) + } + + val r1_1 = 1 + val r1_2 = 2 + val r2_1 = 3 + val r2_2 = 4 + val r3 = 5 + val r4 = 6 + + test(comp()) { t => + t.assertText("S=4, R1=1, R2=1, R3=1, R4=1") + t.clickButton(r2_1); t.assertText("S=1, R1=1, R2=1, R3=1, R4=1") + t.clickButton(r1_2); t.assertText("S=2, R1=1, R2=1, R3=1, R4=1") + t.clickButton(r1_1); t.assertText("S=1, R1=1, R2=1, R3=1, R4=1") + t.clickButton(r2_2); t.assertText("S=2, R1=1, R2=1, R3=1, R4=1") + t.clickButton(r3); t.assertText("S=30, R1=1, R2=1, R3=2, R4=1") + t.clickButton(r4); t.assertText("S=40, R1=1, R2=1, R3=2, R4=1") + t.clickButton(r3); t.assertText("S=-30, R1=1, R2=1, R3=3, R4=1") + t.clickButton(r3); t.assertText("S=30, R1=1, R2=1, R3=4, R4=1") + } + } + + private def testUseStateModStateReusability(): Unit = { + val comp = ScalaFnComponent.withHooks[Unit] + .useState(4) + .renderRR { (_, s) => + <.div( + s"S=${s.value}", + ", R1=", ReusableModIntComponent(s.modState), + ", R2=", ReusableModIntComponent(s.modState), + ", R3=", ReusableCallbackComponent(s.withReusableInputs.modState(if (s.value >= 28) incBy5 else incBy1)), + ", R4=", ReusableCallbackComponent(s.withReusableInputs.modState(incBy1)), + ) + } + + val r1_1 = 1 + val r1_10 = 2 + val r2_1 = 3 + val r2_10 = 4 + val r3 = 5 + val r4 = 6 + + test(comp()) { t => + t.assertText("S=4, R1=1, R2=1, R3=1, R4=1") + t.clickButton(r2_1); t.assertText("S=5, R1=1, R2=1, R3=1, R4=1") + t.clickButton(r1_10); t.assertText("S=15, R1=1, R2=1, R3=1, R4=1") + t.clickButton(r1_1); t.assertText("S=16, R1=1, R2=1, R3=1, R4=1") + t.clickButton(r2_10); t.assertText("S=26, R1=1, R2=1, R3=1, R4=1") + t.clickButton(r3); t.assertText("S=27, R1=1, R2=1, R3=1, R4=1") + t.clickButton(r4); t.assertText("S=28, R1=1, R2=1, R3=2, R4=1") + t.clickButton(r3); t.assertText("S=33, R1=1, R2=1, R3=2, R4=1") + } + } + + private def testUseStateWithReuse(): Unit = { + implicit val reusability: Reusability[PI] = Reusability.by[PI, Int](_.pi >> 1) + + val comp = ScalaFnComponent.withHooks[PI] + .useStateWithReuse(PI(100)) + .useStateWithReuseBy((p, s1) => p + s1.value) + .useStateWithReuseBy($ => $.props + $.hook1.value + $.hook2.value) + .renderRR((p, s1, s2, s3) => + <.div( + <.div(s"P=$p, s1=${s1.value}, s2=${s2.value}, s3=${s3.value}"), + <.button(^.onClick --> ( + s1.modState(_ + 2) >> s2.modState(-_) >> s3.modState(_ * 10) + )), + <.button(^.onClick --> ( + s1.modState(_ + 1) >> s2.modState(-_) + )), + )) + + test(comp(PI(666))) { t => + t.assertText("P=PI(666), s1=PI(100), s2=PI(766), s3=PI(1532)") + t.clickButton(1); t.assertText("P=PI(666), s1=PI(102), s2=PI(-766), s3=PI(15320)") + t.clickButton(2); t.assertText("P=PI(666), s1=PI(102), s2=PI(766), s3=PI(15320)") + } + } + + private def testUseStateWithReuseSetStateReusability(): Unit = { + implicit val reusability: Reusability[PI] = Reusability[PI]((x, y) => (x.pi - y.pi).abs <= 1) + + val comp = ScalaFnComponent.withHooks[Unit] + .useStateWithReuse(PI(4)) + .renderRR { (_, s) => + <.div( + s"S=${s.value}", + ", R1=", ReusableSetIntComponent(s.setState.map(f => (i: Int) => f(PI(i)).value)), + ", R2=", ReusableSetIntComponent(s.setState.map(f => (i: Int) => f(PI(i)).value)), + ", R3=", ReusableCallbackComponent(s.setState(PI(if (s.value.pi >= 30) -30 else 30))), + ", R4=", ReusableCallbackComponent(s.setState(PI(40))), + ) + } + + val r1_1 = 1 + val r1_2 = 2 + val r2_1 = 3 + val r2_2 = 4 + val r3 = 5 + val r4 = 6 + + test(comp()) { t => + t.assertText("S=PI(4), R1=1, R2=1, R3=1, R4=1") + t.clickButton(r2_1); t.assertText("S=PI(1), R1=1, R2=1, R3=1, R4=1") + t.clickButton(r1_2); t.assertText("S=PI(1), R1=1, R2=1, R3=1, R4=1") + t.clickButton(r3); t.assertText("S=PI(30), R1=1, R2=1, R3=2, R4=1") + t.clickButton(r4); t.assertText("S=PI(40), R1=1, R2=1, R3=2, R4=1") + t.clickButton(r2_2); t.assertText("S=PI(2), R1=1, R2=1, R3=3, R4=1") + t.clickButton(r1_1); t.assertText("S=PI(2), R1=1, R2=1, R3=3, R4=1") + t.clickButton(r3); t.assertText("S=PI(30), R1=1, R2=1, R3=4, R4=1") + t.clickButton(r3); t.assertText("S=PI(-30), R1=1, R2=1, R3=5, R4=1") + t.clickButton(r3); t.assertText("S=PI(30), R1=1, R2=1, R3=6, R4=1") + } + } + + private def testUseStateWithReuseModStateReusability(): Unit = { + implicit val reusability: Reusability[PI] = Reusability.by[PI, Int](_.pi >> 1) + val comp = ScalaFnComponent.withHooks[Unit] + .useStateWithReuse(PI(4)) + .renderRR { (_, s) => + <.div( + s"S=${s.value}", + ", R0=", ReusableCallbackComponent(s.modState(_ + 1)), + ", R1=", ReusableCallbackComponent(s.modState(_ + 2)), + ", R2=", ReusableCallbackComponent(s.modState(_ + 4)), + ) + } + + val inc1 = 1 + val inc2 = 2 + val inc4 = 3 + + test(comp()) { t => + t.assertText("S=PI(4), R0=1, R1=1, R2=1") + t.clickButton(inc2); t.assertText("S=PI(6), R0=1, R1=1, R2=1") + t.clickButton(inc4); t.assertText("S=PI(10), R0=1, R1=1, R2=1") + t.clickButton(inc1); t.assertText("S=PI(10), R0=1, R1=1, R2=1") + t.clickButton(inc4); t.assertText("S=PI(14), R0=1, R1=1, R2=1") + t.clickButton(inc2); t.assertText("S=PI(16), R0=1, R1=1, R2=1") + } + } + + private def testUseStateSnapshot(): Unit = { + val counter = new Counter + var latestS3 = 0 + val comp = ScalaFnComponent.withHooks[PI] + .useStateSnapshot(100) + .useStateSnapshotBy((p, s1) => p.pi + s1.value) + .useStateSnapshotBy($ => $.props.pi + $.hook1.value + $.hook2.value) + .renderRR { (p, s1, s2, s3) => + latestS3 = s3.value + <.div( + <.button(^.onClick --> (s1.modState(_ + 1) >> s2.modState(-_) >> s3.modState(_ * 10))), + <.button(^.onClick --> s3.modState(_ + 1, CallbackTo(latestS3).flatMap(counter.incCB(_)))), + <.button(^.onClick --> s3.setStateOption(None, counter.incCB)), + s"P=$p", + s", S1=${s1.value}:", ReusableSetIntComponent(s1.underlyingSetFn.map(f => (i: Int) => f(Some(i), Callback.empty))), + s", S2=${s2.value}:", ReusableSetIntComponent(s1.underlyingSetFn.map(f => (i: Int) => f(Some(i), Callback.empty))), + s", S3=${s3.value}:", ReusableSetIntComponent(s1.underlyingSetFn.map(f => (i: Int) => f(Some(i), Callback.empty))), + ) + } + + test(comp(PI(666))) { t => + t.assertText("P=PI(666), S1=100:1, S2=766:1, S3=1532:1") + t.clickButton(1); t.assertText("P=PI(666), S1=101:1, S2=-766:1, S3=15320:1") + t.clickButton(2); t.assertText("P=PI(666), S1=101:1, S2=-766:1, S3=15321:1") + assertEq(counter.value, 15321) // verify that the modState(cb) executes after the state update + t.clickButton(3); t.assertText("P=PI(666), S1=101:1, S2=-766:1, S3=15321:1") + assertEq(counter.value, 15322) // verify that the setState(None, cb) executes (and that ↖ the previous modState effect ↖ doesn't execute again) + t.clickButton(3); t.assertText("P=PI(666), S1=101:1, S2=-766:1, S3=15321:1") + assertEq(counter.value, 15323) + t.clickButton(2); t.assertText("P=PI(666), S1=101:1, S2=-766:1, S3=15322:1") + assertEq(counter.value, 15323 + 15322) + t.clickButton(4); t.assertText("P=PI(666), S1=1:1, S2=-766:1, S3=15322:1") + assertEq(counter.value, 15323 + 15322) + } + } + + private def testUseStateSnapshotWithReuse(): Unit = { + type I = Int {type A=1} + implicit val I = Reusability.int.contramap((_: I) >> 1) + val counter = new Counter + var latestS3 = 0 + val comp = ScalaFnComponent.withHooks[PI] + .useStateSnapshotWithReuse(100) + .useStateSnapshotWithReuseBy((p, s1) => p.pi + s1.value) + .useStateSnapshotWithReuseBy($ => $.props.pi + $.hook1.value + $.hook2.value) + .useStateSnapshotWithReuse(330.asInstanceOf[I]) + .renderRR { (p, s1, s2, s3, s4) => + latestS3 = s3.value + <.div( + <.button(^.onClick --> (s1.modState(_ + 1) >> s2.modState(-_) >> s3.modState(_ * 10))), + <.button(^.onClick --> s3.modState(_ + 1, CallbackTo(latestS3).flatMap(counter.incCB(_)))), + <.button(^.onClick --> s3.setStateOption(None, counter.incCB)), + s"P=$p", + ", S1=", ReusableStateSnapshotComponent(s1), // buttons: 4 & 5 + ", S2=", ReusableStateSnapshotComponent(s2), // buttons: 6 & 7 + ", S3=", ReusableStateSnapshotComponent(s3), // buttons: 8 & 9 + s", S4=", ReusableStateSnapshotComponent(s4.asInstanceOf[StateSnapshot[Int]]), // buttons: 10 & 11 + ) + } + + test(comp(PI(666))) { t => + t.assertText("P=PI(666), S1=100:1, S2=766:1, S3=1532:1, S4=330:1") + t.clickButton(1); t.assertText("P=PI(666), S1=101:2, S2=-766:2, S3=15320:2, S4=330:1") + t.clickButton(2); t.assertText("P=PI(666), S1=101:2, S2=-766:2, S3=15321:3, S4=330:1") + assertEq(counter.value, 15321) // verify that the modState(cb) executes after the state update + t.clickButton(3); t.assertText("P=PI(666), S1=101:2, S2=-766:2, S3=15321:3, S4=330:1") + assertEq(counter.value, 15322) // verify that the setState(None, cb) executes (and that ↖ the previous modState effect ↖ doesn't execute again) + t.clickButton(3); t.assertText("P=PI(666), S1=101:2, S2=-766:2, S3=15321:3, S4=330:1") + assertEq(counter.value, 15323) + t.clickButton(2); t.assertText("P=PI(666), S1=101:2, S2=-766:2, S3=15322:4, S4=330:1") + assertEq(counter.value, 15323 + 15322) + t.clickButton(4); t.assertText("P=PI(666), S1=102:3, S2=-766:2, S3=15322:4, S4=330:1") + t.clickButton(4); t.assertText("P=PI(666), S1=103:4, S2=-766:2, S3=15322:4, S4=330:1") + assertEq(counter.value, 15323 + 15322) + t.clickButton(11); t.assertText("P=PI(666), S1=103:4, S2=-766:2, S3=15322:4, S4=340:2") + t.clickButton(10); t.assertText("P=PI(666), S1=103:4, S2=-766:2, S3=15322:4, S4=340:2") // reusability blocks update + t.clickButton(11); t.assertText("P=PI(666), S1=103:4, S2=-766:2, S3=15322:4, S4=350:3") + } + } + + private def testRenderWithReuse(): Unit = { + implicit val reusability: Reusability[PI] = Reusability.by[PI, Int](_.pi >> 1) + var renders = 0 + var extState = 5 + val comp = ScalaFnComponent.withHooks[PI] + .useState(20) + .useCallback(Callback(extState += 1)) + .useForceUpdate + .renderWithReuse { (p, s, incES, fu) => + renders += 1 + <.div( + s"P=$p, S=${s.value}, ES=$extState, R=$renders", + <.button(^.onClick --> s.modState(_ + 1)), + <.button(^.onClick --> (incES >> fu)), + ) + } + + val wrapper = ScalaComponent.builder[PI].render_P(comp(_)).build + + withRenderedIntoBody(wrapper(PI(3))) { (m, root) => + val t = new DomTester(root) + t.assertText("P=PI(3), S=20, ES=5, R=1") + replaceProps(wrapper, m)(PI(2)); t.assertText("P=PI(3), S=20, ES=5, R=1") + t.clickButton(1); t.assertText("P=PI(2), S=21, ES=5, R=2") + replaceProps(wrapper, m)(PI(2)); t.assertText("P=PI(2), S=21, ES=5, R=2") + replaceProps(wrapper, m)(PI(3)); t.assertText("P=PI(2), S=21, ES=5, R=2") + replaceProps(wrapper, m)(PI(4)); t.assertText("P=PI(4), S=21, ES=5, R=3") + t.clickButton(2); t.assertText("P=PI(4), S=21, ES=6, R=4") + replaceProps(wrapper, m)(PI(5)); t.assertText("P=PI(4), S=21, ES=6, R=4") + } + } + + // See https://github.com/japgolly/scalajs-react/issues/1027 + private def testRenderWithReuseNever(): Unit = { + implicit val reusability: Reusability[PI] = Reusability.never + var renders = 0 + val comp = ScalaFnComponent.withHooks[PI] + .renderWithReuse { p => + renders += 1 + <.div(s"P=$p, R=$renders") + } + + val wrapper = ScalaComponent.builder[PI] + .initialStateFromProps(identity) + .renderS { ($, s) => + <.div( + comp(s), + <.button(^.onClick --> $.modState(_ + 0)), + <.button(^.onClick --> $.modState(_ + 1)), + ) + } + .build + + withRenderedIntoBody(wrapper(PI(3))) { (_, root) => + val t = new DomTester(root) + t.assertText("P=PI(3), R=1") + t.clickButton(2); t.assertText("P=PI(4), R=2") + t.clickButton(1); t.assertText("P=PI(4), R=3") + } + } + + private def testRenderWithReuseAndUseRef(): Unit = { + val comp = ScalaFnComponent.withHooks[Unit] + .useRef(100) + .useState(0) + .renderWithReuse { (_, ref, s) => + <.div( + ref.value, + <.button(^.onClick --> ref.mod(_ + 1)), + <.button(^.onClick --> s.modState(_ + 1)), + ) + } + + test(comp()) { t => + t.assertText("100") + t.clickButton(1); t.assertText("100") + t.clickButton(2); t.assertText("101") + t.clickButton(1); t.assertText("101") + t.clickButton(2); t.assertText("102") + } + } + + private def testRenderWithReuseAndUseRefToVdom(): Unit = { + var text = "uninitialised" + val comp = ScalaFnComponent.withHooks[Unit] + .useRefToVdom[Input] + .useState("x") + .renderWithReuse { (_, inputRef, s) => + + def onChange(e: ReactEventFromInput): Callback = + s.setState(e.target.value) + + def btn: Callback = + for { + i <- inputRef.get.asCBO + // _ <- Callback.log(s"i.value = [${i.value}]") + } yield { + text = i.value + } + + <.div( + <.input.text.withRef(inputRef)(^.value := s.value, ^.onChange ==> onChange), + <.button(^.onClick --> btn) + ) + } + + test(comp()) { t => + t.assertInputText("x") + t.clickButton() + assertEq(text, "x") + + t.setInputText("hehe") + t.assertInputText("hehe") + t.clickButton() + assertEq(text, "hehe") + } + } + + // =================================================================================================================== + + override def tests = Tests { + "custom" - { + "usage" - testCustomHook() + "composition" - testCustomHookComposition() + } + "localLazyVal" - testLazyVal() + "localVal" - testVal() + "localVar" - testVar() + "useCallback" - { + "const" - testUseCallback() + "constBy" - testUseCallbackBy() + "deps" - testUseCallbackWithDeps() + "depsBy" - testUseCallbackWithDepsBy() + } + "unchecked" - testUnchecked() + "useContext" - testUseContext() + // "useDebugValue" - testUseDebugValue() TODO: reenable + "useEffect" - { + import UseEffect._ + "const" - testConst() + "constBy" - testConstBy() + "deps" - testWithDeps() + "depsBy" - testWithDepsBy() + "mount" - testOnMount() + "mountBy" - testOnMountBy() + } + "useForceUpdate" - testUseForceUpdate() + "useLayoutEffect" - { + import UseLayoutEffect._ + "const" - testConst() + "constBy" - testConstBy() + "deps" - testWithDeps() + "depsBy" - testWithDepsBy() + "mount" - testOnMount() + "mountBy" - testOnMountBy() + } + "useMemo" - { + "deps" - testUseMemo() + "depsBy" - testUseMemoBy() + } + "useRef" - { + "manual" - testUseRefManual() + "manualBy" - testUseRefManualBy() + "vdom" - testUseRefVdom() + } + "useReducer" - testUseReducer() + "useState" - { + "state" - testUseState() + "reusability" - { + "set" - testUseStateSetStateReusability() + "mod" - testUseStateModStateReusability() + } + } + "useStateWithReuse" - { + "state" - testUseStateWithReuse() + "reusability" - { + "set" - testUseStateWithReuseSetStateReusability() + "mod" - testUseStateWithReuseModStateReusability() + } + } + "useStateSnapshot" - testUseStateSnapshot() + "useStateSnapshotWithReuse" - testUseStateSnapshotWithReuse() + + "renderWithReuse" - { + "main" - testRenderWithReuse() + "never" - testRenderWithReuseNever() + "useRef" - testRenderWithReuseAndUseRef() + "useRefToVdom" - testRenderWithReuseAndUseRefToVdom() + } + } +} diff --git a/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksTest.scala b/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksTest.scala index 31d9cafcc..6c0e7c632 100644 --- a/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksTest.scala +++ b/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksTest.scala @@ -112,7 +112,7 @@ object HooksTest extends TestSuite { private def testCustomHook(): Unit = { // TODO: https://github.com/lampepfl/dotty/issues/12663 - (new ScalaSpecificHooksTest).testCustomHook() + ScalaSpecificHooksTest.testCustomHook() // val counter = new Counter @@ -144,11 +144,6 @@ object HooksTest extends TestSuite { } private def testCustomHookComposition(): Unit = { - new TestCustomHookComposition - } - - // TODO: Temporary workaround to https://github.com/lampepfl/dotty/issues/15435 - private class TestCustomHookComposition { locally { type LL = CustomHook[Long, Long] type II = CustomHook[Int, Int] From 19a50aa8c773f5dc666e6ebb8321ea66d497169c Mon Sep 17 00:00:00 2001 From: David Barri Date: Thu, 16 Jun 2022 12:32:43 +1000 Subject: [PATCH 46/72] Reorder methods in HookMacros --- .../scalajs/react/hooks/HookMacros.scala | 22 +++--- .../scalajs/react/hooks/HookMacros.scala | 72 ++++++++++--------- 2 files changed, 49 insertions(+), 45 deletions(-) diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala index 789f293a7..1e751973d 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -9,6 +9,18 @@ import scala.reflect.macros.blackbox.Context class HookMacros(val c: Context) extends MacroUtils { import c.universe._ + def render[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] + (f: c.Tree)(step: c.Tree, s: c.Tree) + (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = + _render(f, step, s, false)(P, C) + + def renderDebug[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] + (f: c.Tree)(step: c.Tree, s: c.Tree) + (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = + _render(f, step, s, true)(P, C) + + // =================================================================================================================== + private implicit def autoTagToType[A](t: c.WeakTypeTag[A]): Type = t.tpe private def Box : Tree = q"_root_.japgolly.scalajs.react.internal.Box" @@ -140,16 +152,6 @@ class HookMacros(val c: Context) extends MacroUtils { // =================================================================================================================== - def render[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] - (f: c.Tree)(step: c.Tree, s: c.Tree) - (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = - _render(f, step, s, false)(P, C) - - def renderDebug[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] - (f: c.Tree)(step: c.Tree, s: c.Tree) - (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = - _render(f, step, s, true)(P, C) - def _render[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] (f: c.Tree, step: c.Tree, s: c.Tree, debug: Boolean) (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = { diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala index 0e693030a..54f6b037e 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala @@ -18,6 +18,43 @@ import scala.scalajs.js object HookMacros { + // https://github.com/lampepfl/dotty/issues/15357 + inline def renderWorkaround[ + P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u] + ](self : PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step], + f : CtxFn[VdomNode], + step : Step, + s : CtorType.Summoner.Aux[Box[P], C, CT], + ): Component[P, CT] = + ${ renderMacro[P, C, Ctx, CtxFn, Step, CT]('self, 'f, 'step, 's) } + + inline def renderWorkaroundDebug[ + P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u] + ](self : PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step], + f : CtxFn[VdomNode], + step : Step, + s : CtorType.Summoner.Aux[Box[P], C, CT], + ): Component[P, CT] = + ${ renderMacroDebug[P, C, Ctx, CtxFn, Step, CT]('self, 'f, 'step, 's) } + + def renderMacro[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]] + (self: Expr[PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step]], + f : Expr[CtxFn[VdomNode]], + step : Expr[Step], + s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], + )(using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], CtxFn: Type[CtxFn], Step: Type[Step]): Expr[Component[P, CT]] = + _renderMacro(self, f, step, s, false) + + def renderMacroDebug[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]] + (self: Expr[PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step]], + f : Expr[CtxFn[VdomNode]], + step : Expr[Step], + s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], + )(using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], CtxFn: Type[CtxFn], Step: Type[Step]): Expr[Component[P, CT]] = + _renderMacro(self, f, step, s, true) + + // =================================================================================================================== + private def HookMacrosImpl(qq: Quotes): HookMacrosImpl { val q: qq.type } = new HookMacrosImpl { override implicit val q: qq.type = qq @@ -150,41 +187,6 @@ object HookMacros { // =================================================================================================================== - // https://github.com/lampepfl/dotty/issues/15357 - inline def renderWorkaround[ - P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u] - ](self : PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step], - f : CtxFn[VdomNode], - step : Step, - s : CtorType.Summoner.Aux[Box[P], C, CT], - ): Component[P, CT] = - ${ renderMacro[P, C, Ctx, CtxFn, Step, CT]('self, 'f, 'step, 's) } - - inline def renderWorkaroundDebug[ - P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u] - ](self : PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step], - f : CtxFn[VdomNode], - step : Step, - s : CtorType.Summoner.Aux[Box[P], C, CT], - ): Component[P, CT] = - ${ renderMacroDebug[P, C, Ctx, CtxFn, Step, CT]('self, 'f, 'step, 's) } - - def renderMacro[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]] - (self: Expr[PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step]], - f : Expr[CtxFn[VdomNode]], - step : Expr[Step], - s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], - )(using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], CtxFn: Type[CtxFn], Step: Type[Step]): Expr[Component[P, CT]] = - _renderMacro(self, f, step, s, false) - - def renderMacroDebug[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]] - (self: Expr[PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step]], - f : Expr[CtxFn[VdomNode]], - step : Expr[Step], - s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], - )(using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], CtxFn: Type[CtxFn], Step: Type[Step]): Expr[Component[P, CT]] = - _renderMacro(self, f, step, s, true) - def _renderMacro[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]] (self: Expr[PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step]], f : Expr[CtxFn[VdomNode]], From 073ee30c58482032efcf5a92dfbe5f73d00ce680 Mon Sep 17 00:00:00 2001 From: David Barri Date: Thu, 16 Jun 2022 12:39:59 +1000 Subject: [PATCH 47/72] Refactor: rename secondary render macro methods --- .../scalajs/react/hooks/HookMacros.scala | 22 +++++++++---------- .../react/hooks/HookMacrosTraits.scala | 4 ++-- .../scalajs/react/hooks/HookMacros.scala | 18 +++++++-------- .../react/hooks/HookMacrosTraits.scala | 4 ++-- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala index 1e751973d..9a5a4e88f 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -9,15 +9,15 @@ import scala.reflect.macros.blackbox.Context class HookMacros(val c: Context) extends MacroUtils { import c.universe._ - def render[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] - (f: c.Tree)(step: c.Tree, s: c.Tree) - (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = - _render(f, step, s, false)(P, C) + def render2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] + (f: c.Tree)(step: c.Tree, s: c.Tree) + (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = + _render2(f, step, s, false)(P, C) - def renderDebug[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] - (f: c.Tree)(step: c.Tree, s: c.Tree) - (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = - _render(f, step, s, true)(P, C) + def renderDebug2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] + (f: c.Tree)(step: c.Tree, s: c.Tree) + (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = + _render2(f, step, s, true)(P, C) // =================================================================================================================== @@ -152,9 +152,9 @@ class HookMacros(val c: Context) extends MacroUtils { // =================================================================================================================== - def _render[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] - (f: c.Tree, step: c.Tree, s: c.Tree, debug: Boolean) - (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = { + def _render2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] + (f: c.Tree, step: c.Tree, s: c.Tree, debug: Boolean) + (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = { val hookMacros = new HookMacrosImpl diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacrosTraits.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacrosTraits.scala index c243dfe3e..7284e8a58 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacrosTraits.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacrosTraits.scala @@ -10,8 +10,8 @@ trait ApiSecondaryWithRenderMacros[P, C <: Children, Ctx, CtxFn[_], Step <: Subs self: PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step] => final def renderRR(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = - macro HookMacros.render[P, C, Ctx, CtxFn, Step] + macro HookMacros.render2[P, C, Ctx, CtxFn, Step] final def renderRRDebug(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = - macro HookMacros.renderDebug[P, C, Ctx, CtxFn, Step] + macro HookMacros.renderDebug2[P, C, Ctx, CtxFn, Step] } diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala index 54f6b037e..8a0041929 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala @@ -19,39 +19,39 @@ import scala.scalajs.js object HookMacros { // https://github.com/lampepfl/dotty/issues/15357 - inline def renderWorkaround[ + inline def render2Workaround[ P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u] ](self : PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step], f : CtxFn[VdomNode], step : Step, s : CtorType.Summoner.Aux[Box[P], C, CT], ): Component[P, CT] = - ${ renderMacro[P, C, Ctx, CtxFn, Step, CT]('self, 'f, 'step, 's) } + ${ render2[P, C, Ctx, CtxFn, Step, CT]('self, 'f, 'step, 's) } - inline def renderWorkaroundDebug[ + inline def renderDebug2Workaround[ P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u] ](self : PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step], f : CtxFn[VdomNode], step : Step, s : CtorType.Summoner.Aux[Box[P], C, CT], ): Component[P, CT] = - ${ renderMacroDebug[P, C, Ctx, CtxFn, Step, CT]('self, 'f, 'step, 's) } + ${ renderDebug2[P, C, Ctx, CtxFn, Step, CT]('self, 'f, 'step, 's) } - def renderMacro[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]] + def render2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]] (self: Expr[PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step]], f : Expr[CtxFn[VdomNode]], step : Expr[Step], s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], )(using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], CtxFn: Type[CtxFn], Step: Type[Step]): Expr[Component[P, CT]] = - _renderMacro(self, f, step, s, false) + _render2(self, f, step, s, false) - def renderMacroDebug[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]] + def renderDebug2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]] (self: Expr[PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step]], f : Expr[CtxFn[VdomNode]], step : Expr[Step], s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], )(using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], CtxFn: Type[CtxFn], Step: Type[Step]): Expr[Component[P, CT]] = - _renderMacro(self, f, step, s, true) + _render2(self, f, step, s, true) // =================================================================================================================== @@ -187,7 +187,7 @@ object HookMacros { // =================================================================================================================== - def _renderMacro[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]] + def _render2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]] (self: Expr[PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step]], f : Expr[CtxFn[VdomNode]], step : Expr[Step], diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala index a3ef36529..6fa824fa5 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala @@ -19,8 +19,8 @@ trait ApiSecondaryWithRenderMacros[P, C <: Children, Ctx, CtxFn[_], _Step <: Sub self: PrimaryWithRender[P, C, Ctx, _Step] with Secondary[Ctx, CtxFn, _Step] => inline final def renderRR(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = - HookMacros.renderWorkaround[P, C, Ctx, CtxFn, Step, s.CT](this, f, step, s) + HookMacros.render2Workaround[P, C, Ctx, CtxFn, Step, s.CT](this, f, step, s) inline final def renderRRDebug(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = - HookMacros.renderWorkaroundDebug[P, C, Ctx, CtxFn, Step, s.CT](this, f, step, s) + HookMacros.renderDebug2Workaround[P, C, Ctx, CtxFn, Step, s.CT](this, f, step, s) } From faac76e2bdac6cefe60cfc87b88ab33a88153303 Mon Sep 17 00:00:00 2001 From: David Barri Date: Thu, 16 Jun 2022 15:14:31 +1000 Subject: [PATCH 48/72] Fix rewriting of custom hooks with local vals in Scala 3 This is the fix/workaround for https://github.com/lampepfl/dotty-feature-requests/issues/307 --- library/bin/remove_test_emissions | 8 + .../scalajs/react/hooks/HookMacros.scala | 27 +-- .../scalajs/react/hooks/HookMacros.scala | 81 +++++--- .../react/hooks/HookMacrosTraits.scala | 14 +- .../react/hooks/AbstractHookMacros.scala | 29 +-- .../test/resources/rr-sjr/CustomHooks-out3.js | 63 ++---- .../resources/rr-sjr/CustomHooksBy-out3.js | 91 +++------ .../rr-sjr/HooksWithChildren-out3.js | 60 +++--- .../resources/rr-sjr/HooksWithJsFns-out3.js | 43 +--- .../rr-sjr/HooksWithScalaFns-out3.js | 70 ++----- .../test/resources/rr-sjr/UseState-out3.js | 117 ++++------- .../rr-sjr/UseStateWithReuse-out3.js | 183 ++++++------------ 12 files changed, 287 insertions(+), 499 deletions(-) create mode 100755 library/bin/remove_test_emissions diff --git a/library/bin/remove_test_emissions b/library/bin/remove_test_emissions new file mode 100755 index 000000000..7eeac002e --- /dev/null +++ b/library/bin/remove_test_emissions @@ -0,0 +1,8 @@ +#!/bin/bash + +cd "$(dirname "$0")/.." || exit 1 +[ $# -ne 1 ] && echo "Usage: $0 " && exit 1 + +set -euo pipefail + +rm -fv ./testEmissions/jvm/src/test/resources/rr-sjr/*-out"$1".js diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala index 9a5a4e88f..99242a9e8 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -42,19 +42,20 @@ class HookMacros(val c: Context) extends MacroUtils { override type Type[A] = c.universe.Type override type TypeTree = c.universe.TypeTree - override protected def asTerm [A](e: Expr[A]) = e - override protected def Expr [A](t: Term) = t - override protected def isUnit (t: TypeTree) = t.tpe == typeOf[Unit] - override protected def refToTerm (r: Ref) = Ident(r) - override protected def showCode (t: Term) = c.universe.showCode(t) - override protected def showRaw (t: Term) = c.universe.showRaw(t) - override protected def Type [A](t: TypeTree) = t.tpe - override protected def typeOfTerm (t: Term) = c.universe.TypeTree(t.tpe) - override protected def unitTerm = q"()" - override protected def unitType = c.universe.definitions.UnitTpe - override protected def wrap = (s, b) => q"..$s; $b" - - override def call(function: Tree, args: List[Tree]): Tree = { + override protected def asTerm [A] = identity + override protected def Expr [A] = identity + override protected def isUnit = _.tpe == unitType + override protected def refToTerm = Ident(_) + override protected def showCode = c.universe.showCode(_) + override protected def showRaw = c.universe.showRaw(_) + override protected def Type [A] = _.tpe + override protected def typeOfTerm = t => c.universe.TypeTree(t.tpe) + override protected def uninline = identity + override protected def unitTerm = q"()" + override protected def unitType = c.universe.definitions.UnitTpe + override protected def wrap = (s, b) => Block(s.toList, b) + + override protected def call = (function, args) => { import internal._ function match { case Function(params, body) => diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala index 8a0041929..64417056b 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala @@ -18,40 +18,46 @@ import scala.scalajs.js object HookMacros { + type SecondaryProxy[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] = + ApiSecondaryWithRenderMacros[P, C, Ctx, CtxFn, Step] + + type SecondaryApi[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] = + PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step] + // https://github.com/lampepfl/dotty/issues/15357 inline def render2Workaround[ P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u] - ](self : PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step], - f : CtxFn[VdomNode], - step : Step, - s : CtorType.Summoner.Aux[Box[P], C, CT], + ](inline proxy: SecondaryProxy[P, C, Ctx, CtxFn, Step], + inline f : CtxFn[VdomNode], + inline step : Step, + inline s : CtorType.Summoner.Aux[Box[P], C, CT], ): Component[P, CT] = - ${ render2[P, C, Ctx, CtxFn, Step, CT]('self, 'f, 'step, 's) } + ${ render2[P, C, Ctx, CtxFn, Step, CT]('proxy, 'f, 'step, 's) } inline def renderDebug2Workaround[ P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u] - ](self : PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step], - f : CtxFn[VdomNode], - step : Step, - s : CtorType.Summoner.Aux[Box[P], C, CT], + ](inline proxy: SecondaryProxy[P, C, Ctx, CtxFn, Step], + inline f : CtxFn[VdomNode], + inline step : Step, + inline s : CtorType.Summoner.Aux[Box[P], C, CT], ): Component[P, CT] = - ${ renderDebug2[P, C, Ctx, CtxFn, Step, CT]('self, 'f, 'step, 's) } + ${ renderDebug2[P, C, Ctx, CtxFn, Step, CT]('proxy, 'f, 'step, 's) } def render2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]] - (self: Expr[PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step]], + (proxy: Expr[SecondaryProxy[P, C, Ctx, CtxFn, Step]], f : Expr[CtxFn[VdomNode]], step : Expr[Step], s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], )(using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], CtxFn: Type[CtxFn], Step: Type[Step]): Expr[Component[P, CT]] = - _render2(self, f, step, s, false) + _render2(proxy, f, step, s, false) def renderDebug2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]] - (self: Expr[PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step]], + (proxy: Expr[SecondaryProxy[P, C, Ctx, CtxFn, Step]], f : Expr[CtxFn[VdomNode]], step : Expr[Step], s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], )(using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], CtxFn: Type[CtxFn], Step: Type[Step]): Expr[Component[P, CT]] = - _render2(self, f, step, s, true) + _render2(proxy, f, step, s, true) // =================================================================================================================== @@ -74,17 +80,26 @@ object HookMacros { override type Type[A] = scala.quoted.Type[A] override type TypeTree = q.reflect.TypeTree - override protected def asTerm [A](e: Expr[A]) = e.asTerm - override protected def Expr [A](t: Term) = t.asExprOf[Any].asInstanceOf[Expr[A]] - override protected def refToTerm (r: Ref) = r.ref - override protected def showCode (t: Term) = t.show(using q.reflect.Printer.TreeShortCode) - override protected def showRaw (t: Term) = t.show(using q.reflect.Printer.TreeStructure) - override protected def typeOfTerm (t: Term) = t.tpe.asTypeTree - override protected def unitTerm = '{ () } - override protected def unitType = scala.quoted.Type.of[Unit] - override protected def wrap = (s, b) => Block(s.toList, b) - - override def call(function: Term, args: List[Term]): Term = { + override protected def asTerm [A] = _.asTerm + override protected def Expr [A] = _.asExprOf[Any].asInstanceOf[Expr[A]] + override protected def refToTerm = _.ref + override protected def showCode = _.show(using q.reflect.Printer.TreeShortCode) + override protected def showRaw = _.show(using q.reflect.Printer.TreeStructure) + override protected def typeOfTerm = _.tpe.asTypeTree + override protected def uninline = _uninline + override protected def unitTerm = '{ () } + override protected def unitType = scala.quoted.Type.of[Unit] + override protected def wrap = (s, b) => Block(s.toList, b) + + // TODO: Move into microlibs (and make tailrec and non-recursive versions) + @tailrec + private def _uninline(t: Term): Term = + t match { + case Inlined(_, _, e) => _uninline(e) + case _ => t + } + + override protected def call = (function, args) => { val f = extractFunction(function) val t = Apply(Select.unique(f, "apply"), args) Term.betaReduce(t).getOrElse(t) @@ -98,13 +113,13 @@ object HookMacros { case f => f } - override protected def isUnit(t: TypeTree): Boolean = - t.tpe.asType match { + override protected def isUnit = + _.tpe.asType match { case '[Unit] => true case _ => false } - override protected def Type[A](t: TypeTree) = { + override protected def Type[A] = t => { val x: scala.quoted.Type[?] = t.asType x.asInstanceOf[scala.quoted.Type[A]] } @@ -188,7 +203,7 @@ object HookMacros { // =================================================================================================================== def _render2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]] - (self: Expr[PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step]], + (proxy: Expr[SecondaryProxy[P, C, Ctx, CtxFn, Step]], f : Expr[CtxFn[VdomNode]], step : Expr[Step], s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], @@ -203,14 +218,18 @@ object HookMacros { log.enabled = debug // f.show.contains("DEBUG") log.header() - // log("self", self.asTerm.underlying.show) + val self = proxy.asInstanceOf[Expr[SecondaryApi[P, C, Ctx, CtxFn, Step]]] + + val macroApplication = self.asTerm + + log("self", macroApplication.show) val renderStep = HookStep("renderRR", Nil, List(List(f.asTerm), List(step.asTerm, s.asTerm))) val rewriteAttempt = for { - hookDefn <- hookMacros.parse(self.asTerm.underlying) + hookDefn <- hookMacros.parse(macroApplication) rewriter <- hookMacros.rewriteComponent(hookDefn + renderStep) } yield rewriter diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala index 6fa824fa5..086f2ca28 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala @@ -17,10 +17,16 @@ import scala.scalajs.js trait ApiSecondaryWithRenderMacros[P, C <: Children, Ctx, CtxFn[_], _Step <: SubsequentStep[Ctx, CtxFn]] { self: PrimaryWithRender[P, C, Ctx, _Step] with Secondary[Ctx, CtxFn, _Step] => +} + +object ApiSecondaryWithRenderMacros { + + extension [P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]](inline self: ApiSecondaryWithRenderMacros[P, C, Ctx, CtxFn, Step]) { - inline final def renderRR(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = - HookMacros.render2Workaround[P, C, Ctx, CtxFn, Step, s.CT](this, f, step, s) + inline def renderRR(inline f: CtxFn[VdomNode])(implicit inline step: Step, inline s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = + HookMacros.render2Workaround[P, C, Ctx, CtxFn, Step, s.CT](self, f, step, s) - inline final def renderRRDebug(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = - HookMacros.renderDebug2Workaround[P, C, Ctx, CtxFn, Step, s.CT](this, f, step, s) + inline def renderRRDebug(inline f: CtxFn[VdomNode])(implicit inline step: Step, inline s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = + HookMacros.renderDebug2Workaround[P, C, Ctx, CtxFn, Step, s.CT](self, f, step, s) + } } diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala index 4f8cbd6f4..f567a279c 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala @@ -151,19 +151,20 @@ trait AbstractHookMacros { def unapply(function: Term): Option[Success] } - protected def asTerm [A](e: Expr[A]) : Term - protected def call (function: Term, args: List[Term]): Term - protected def Expr [A](t: Term) : Expr[A] - protected def isUnit (t: TypeTree) : Boolean - protected def refToTerm (r: Ref) : Term - protected def showCode (t: Term) : String - protected def showRaw (t: Term) : String - protected def Type [A](t: TypeTree) : Type[A] - protected def typeOfTerm (t: Term) : TypeTree - protected def unitTerm : Expr[Unit] - protected def unitType : Type[Unit] - protected def wrap : (Vector[Stmt], Term) => Term - protected val rewriterBridge : RewriterBridge + protected def asTerm [A]: Expr[A] => Term + protected def call : (Term, List[Term]) => Term + protected def Expr [A]: Term => Expr[A] + protected def isUnit : TypeTree => Boolean + protected def refToTerm : Ref => Term + protected def showCode : Term => String + protected def showRaw : Term => String + protected def Type [A]: TypeTree => Type[A] + protected def typeOfTerm : Term => TypeTree + protected def uninline : Term => Term + protected def unitTerm : Expr[Unit] + protected def unitType : Type[Unit] + protected def wrap : (Vector[Stmt], Term) => Term + protected val rewriterBridge: RewriterBridge protected def custom[I, O]: (Type[I], Type[O], Expr[CustomHook[I, O]], Expr[I]) => Expr[O] protected def customArg[C, A]: (Type[C], Type[A], Expr[CustomHook.Arg[C, A]], Expr[C]) => Expr[A] @@ -227,7 +228,7 @@ trait AbstractHookMacros { @tailrec private def _parse(tree: Term, targs: List[TypeTree], args: List[List[Term]], steps: List[HookStep]): Either[() => String, HookDefn] = - tree match { + uninline(tree) match { case ApplyLike(t, a) => _parse(t, targs, a :: args, steps) diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out3.js index 9da71f900..5b06117d4 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out3.js @@ -6,17 +6,10 @@ import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024 f import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay from "./japgolly.scalajs.react.callback.Trampoline$Delay.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024$0024anon$00241 from "./japgolly.scalajs.react.hooks.Api$$anon$1.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.Api$$anon$2.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary from "./japgolly.scalajs.react.hooks.Api$Primary.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00241 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$1.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$2.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Arg$0024 from "./japgolly.scalajs.react.hooks.CustomHook$Arg$.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First from "./japgolly.scalajs.react.hooks.CustomHook$Builder$First.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024Subsequent from "./japgolly.scalajs.react.hooks.CustomHook$Builder$Subsequent.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024 from "./japgolly.scalajs.react.hooks.HookComponentBuilder$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024First from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentP$First.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024Subsequent from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentP$Subsequent.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024I1 from "./japgolly.scalajs.react.hooks.HookCtx$I1.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.Hooks$$anon$2.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseEffectArg$.js"; @@ -26,7 +19,6 @@ import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./ import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite from "./japgolly.scalajs.react.vdom.TagLite.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagMod from "./japgolly.scalajs.react.vdom.TagMod.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode from "./japgolly.scalajs.react.vdom.VdomNode.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; @@ -34,7 +26,6 @@ import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js" import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; import * as $j_scala$002eFunction1 from "./scala.Function1.js"; import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; -import * as $j_scala$002escalajs$002eruntime$002eAnonFunction3 from "./scala.scalajs.runtime.AnonFunction3.js"; import * as $j_scala$002escalajs$002eruntime$002eCompat$0024 from "./scala.scalajs.runtime.Compat$.js"; function $c_Ljapgolly_scalajs_react_test_emissions_CustomHooks$() { @@ -70,51 +61,27 @@ function $c_Ljapgolly_scalajs_react_test_emissions_CustomHooks$() { var _$3$1 = _$3; return _$3$1.Ljapgolly_scalajs_react_hooks_HookCtx$I1__f_hook1; })); - $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$(); - var this$14 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024.$m_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$().apply__Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$First(); - var hook = this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook1; - var step$3 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024First.$c_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$FirstStep(); - var a$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Arg$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$Arg$().exactId__F1(); - var d = new $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_hooks_Api$$anon$1(); - var this$18 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__custom__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__F1__Ljapgolly_scalajs_react_hooks_Api$DynamicNextStep__O(this$14, hook, step$3, a$1, d); - var hook$1 = this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook2; - var step$4 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$1(); - var this$16 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Arg$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$Arg$(); - var a$2 = this$16.const__O__F1(void 0); - var d$1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024$0024anon$00242.$c_Ljapgolly_scalajs_react_hooks_Api$$anon$2(); - var this$22 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__custom__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__F1__Ljapgolly_scalajs_react_hooks_Api$DynamicNextStep__O(this$18, hook$1, step$4, a$2, d$1); - var hook$2 = this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook3; - var step$5 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$1(); - var this$20 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Arg$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$Arg$(); - var a$3 = this$20.const__O__F1(void 0); - var d$2 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_hooks_Api$$anon$1(); - $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__custom__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__F1__Ljapgolly_scalajs_react_hooks_Api$DynamicNextStep__O(this$22, hook$2, step$5, a$3, d$2); - var f$proxy4 = new $j_scala$002escalajs$002eruntime$002eAnonFunction3.$c_sjsr_AnonFunction3((p, s1, s2) => { - var p$1 = p | 0; - var s1$1 = s1; - var s2$1 = s2; - var sum = (p$1 + (s1$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (s2$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; - var this$29 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + + var rawComponent = (this$6$1 => props => { + var hook1_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Arg$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$Arg$().exactId__F1().apply__O__O(props.a) | 0; + var hook1 = this$6$1.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook1.apply__O__O(hook1_arg); + this$6$1.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook2.apply__O__O(void 0); + var hook3 = this$6$1.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook3.apply__O__O(void 0); + var p = props.a | 0; + var sum = (p + (hook1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (hook3.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; + var this$17 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); var self = "div"; var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum))])); - return $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$29, self, xs); - }); - new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00242.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$2(); - var s$proxy1 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); - - var rawComponent = ((this$7$1, f$proxy4$2) => props => { - var hook1_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Arg$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$Arg$().exactId__F1().apply__O__O(props.a) | 0; - var hook1 = this$7$1.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook1.apply__O__O(hook1_arg); - this$7$1.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook2.apply__O__O(void 0); - var hook3 = this$7$1.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook3.apply__O__O(void 0); - return f$proxy4$2.apply__O__O__O__O(props.a, hook1, hook3).rawNode__O(); - })(this, f$proxy4); + var this$18 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$17, self, xs); + return this$18.rawElement__Ljapgolly_scalajs_react_facade_React$Element(); + })(this); var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); - var this$31 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); - this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$31.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s$proxy1)); + var this$19 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); + this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$19.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); } export { $c_Ljapgolly_scalajs_react_test_emissions_CustomHooks$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out3.js index 0eea5c29e..9266428b8 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out3.js @@ -3,18 +3,10 @@ import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024$0024anon$00241 from "./japgolly.scalajs.react.hooks.Api$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary from "./japgolly.scalajs.react.hooks.Api$Primary.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Secondary from "./japgolly.scalajs.react.hooks.Api$Secondary.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00241 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$1.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$2.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00243 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$3.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook from "./japgolly.scalajs.react.hooks.CustomHook.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024 from "./japgolly.scalajs.react.hooks.CustomHook$.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First from "./japgolly.scalajs.react.hooks.CustomHook$Builder$First.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024Subsequent from "./japgolly.scalajs.react.hooks.CustomHook$Builder$Subsequent.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024 from "./japgolly.scalajs.react.hooks.HookComponentBuilder$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024First from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentP$First.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024Subsequent from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentP$Subsequent.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024I1 from "./japgolly.scalajs.react.hooks.HookCtx$I1.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2 from "./japgolly.scalajs.react.hooks.HookCtx$P2.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.Hooks$$anon$2.js"; @@ -23,15 +15,12 @@ import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./ import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite from "./japgolly.scalajs.react.vdom.TagLite.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagMod from "./japgolly.scalajs.react.vdom.TagMod.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode from "./japgolly.scalajs.react.vdom.VdomNode.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; import * as $j_scala$002eFunction1 from "./scala.Function1.js"; -import * as $j_scala$002escalajs$002eruntime$002eAnonFunction2 from "./scala.scalajs.runtime.AnonFunction2.js"; -import * as $j_scala$002escalajs$002eruntime$002eAnonFunction4 from "./scala.scalajs.runtime.AnonFunction4.js"; function $c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$() { this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook1 = null; @@ -72,68 +61,36 @@ function $c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$() { var _$6$1 = _$6; return _$6$1.Ljapgolly_scalajs_react_hooks_HookCtx$I1__f_hook1; })); - $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$(); - var this$11 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024.$m_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$().apply__Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$First(); - var hook = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1((this$7$1 => v1 => { - var p = v1 | 0; - return new $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook.$c_Ljapgolly_scalajs_react_hooks_CustomHook($j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1(this$7$1.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook1, -1 + p | 0)); - })(this)); - var step$3 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024First.$c_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$FirstStep(); - var d = new $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_hooks_Api$$anon$1(); - var this$14 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__customBy__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__Ljapgolly_scalajs_react_hooks_Api$DynamicNextStep__O(this$11, hook, step$3, d); - var hook$1 = new $j_scala$002escalajs$002eruntime$002eAnonFunction2.$c_sjsr_AnonFunction2((this$8$1 => (v1$2, v2) => { - var s1 = v2; - return new $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook.$c_Ljapgolly_scalajs_react_hooks_CustomHook($j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1(this$8$1.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook2, s1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0])); - })(this)); - var step$4 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$1(); - var d$1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_hooks_Api$$anon$1(); - var this$18 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Secondary.$f_Ljapgolly_scalajs_react_hooks_Api$Secondary__customBy__O__Ljapgolly_scalajs_react_hooks_Api$SubsequentStep__Ljapgolly_scalajs_react_hooks_Api$DynamicNextStep__O(this$14, hook$1, step$4, d$1); - var hook$2 = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1((this$9$1 => δ => { - var δ$1 = δ; - var $$x2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); - var $$x1 = this$9$1.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook3; - var this$15 = δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; - return new $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook.$c_Ljapgolly_scalajs_react_hooks_CustomHook($$x2.apply$extension__F1__O__F1($$x1, this$15.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0])); - })(this)); - var step$5 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00242.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$2(); - var d$2 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_hooks_Api$$anon$1(); - $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__customBy__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__Ljapgolly_scalajs_react_hooks_Api$DynamicNextStep__O(this$18, hook$2, step$5, d$2); - var f$proxy1 = new $j_scala$002escalajs$002eruntime$002eAnonFunction4.$c_sjsr_AnonFunction4((p$1, s1$1, s2, s3) => { - var p$2 = p$1 | 0; - var s1$2 = s1$1; - var s2$1 = s2; - var s3$1 = s3; - var sum = ((p$2 + (s1$2.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (s2$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (s3$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; - var this$25 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); - $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); - $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); - var self = "div"; - var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum))])); - return $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$25, self, xs); - }); - new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00243.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$3(); - var s$proxy1 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); - var rawComponent = ((this$11$1, f$proxy1$2) => props => { - var p$3 = props.a | 0; - var hook1_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1(this$11$1.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook1, -1 + p$3 | 0); + var rawComponent = (this$7$1 => props => { + var p = props.a | 0; + var hook1_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1(this$7$1.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook1, -1 + p | 0); var hook1 = hook1_raw.apply__O__O(void 0); props.a | 0; - var hook2_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1(this$11$1.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook2, hook1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); + var hook2_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1(this$7$1.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook2, hook1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); var hook2 = hook2_raw.apply__O__O(void 0); var props$1 = props.a; - var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, hook1, hook2); - var $$x4 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); - var $$x3 = this$11$1.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook3; - var this$28 = hook3_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; - var hook3_raw = $$x4.apply$extension__F1__O__F1($$x3, this$28.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); + var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$1, hook1, hook2); + var $$x2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); + var $$x1 = this$7$1.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook3; + var this$9 = hook3_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; + var hook3_raw = $$x2.apply$extension__F1__O__F1($$x1, this$9.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); var hook3 = hook3_raw.apply__O__O(void 0); - return f$proxy1$2.apply__O__O__O__O__O(props.a, hook1, hook2, hook3).rawNode__O(); - })(this, f$proxy1); + var p$2 = props.a | 0; + var sum = ((p$2 + (hook1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (hook2.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (hook3.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; + var this$16 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self = "div"; + var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum))])); + var this$17 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$16, self, xs); + return this$17.rawElement__Ljapgolly_scalajs_react_facade_React$Element(); + })(this); - var $$x5 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); - var this$29 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); - this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_Component = $$x5.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$29.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s$proxy1)); + var $$x3 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$18 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); + this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_Component = $$x3.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$18.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); } export { $c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out3.js index 08821c484..a759650f8 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out3.js @@ -7,21 +7,14 @@ import * as $j_japgolly$002escalajs$002ereact$002eReusability from "./japgolly.s import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary from "./japgolly.scalajs.react.hooks.Api$Primary.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentPC$005fSubsequentSteps$0024$0024anon$002421 from "./japgolly.scalajs.react.hooks.ComponentPC_SubsequentSteps$$anon$21.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024 from "./japgolly.scalajs.react.hooks.HookComponentBuilder$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentPC$0024FirstStep from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentPC$FirstStep.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentPC$0024Subsequent from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentPC$Subsequent.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.Hooks$$anon$2.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; -import * as $j_japgolly$002escalajs$002ereact$002epackage$0024 from "./japgolly.scalajs.react.package$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024 from "./japgolly.scalajs.react.vdom.Attr$EventCallback$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite from "./japgolly.scalajs.react.vdom.TagLite.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagMod from "./japgolly.scalajs.react.vdom.TagMod.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode from "./japgolly.scalajs.react.vdom.VdomNode.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; @@ -29,54 +22,45 @@ import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js" import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; import * as $j_scala$002eFunction1 from "./scala.Function1.js"; import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; -import * as $j_scala$002escalajs$002eruntime$002eAnonFunction3 from "./scala.scalajs.runtime.AnonFunction3.js"; function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$() { + var _s = $RefreshSig$(); + this.Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$__f_Component = null; $n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$ = this; - var this$4 = ($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$(), $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024.$m_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$().apply__Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$First()).withPropsChildren__Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentPC$First(); - var initialState = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => 123); - var step = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentPC$0024FirstStep.$c_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentPC$FirstStep(); - $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useState__F0__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$4, initialState, step); - var f$proxy1 = new $j_scala$002escalajs$002eruntime$002eAnonFunction3.$c_sjsr_AnonFunction3((p, c, s1) => { - var p$1 = p | 0; - var s1$1 = s1; - var sum = (p$1 + (s1$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + ($i_react.Children.count(c) | 0) | 0; - var this$18 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + + var rawComponent = props => { + _s(); + + var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024package$0024PropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$package$PropsChildren$().fromRawProps__sjs_js_Object__O(props); + var hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); + var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); + var p = props.a | 0; + var sum = (p + (hook1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + ($i_react.Children.count(children) | 0) | 0; + var this$15 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); var self = "button"; - var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((s1$2 => () => { + var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((hook1$2 => () => { $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); - var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(s1$2); + var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(hook1$2); var ev$1 = r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$1 => { var _$1$1 = _$1 | 0; return 1 + _$1$1 | 0; })); return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(ev$1 === null ? null : ev$1.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline); - })(s1$1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(c))])); - return $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$18, self, xs); - }); - new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentPC$005fSubsequentSteps$0024$0024anon$002421.$c_Ljapgolly_scalajs_react_hooks_ComponentPC_SubsequentSteps$$anon$21(); - var s$proxy1 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonPC__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); - - var rawComponent = (f$proxy1$2 => { - var _s = $RefreshSig$(); - - return _s(props => { - _s(); + })(hook1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(children))])); + var this$16 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$15, self, xs); + return this$16.rawElement__Ljapgolly_scalajs_react_facade_React$Element(); + }; - var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024package$0024PropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$package$PropsChildren$().fromRawProps__sjs_js_Object__O(props); - var hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); - var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); - return f$proxy1$2.apply__O__O__O__O(props.a, children, hook1).rawNode__O(); - }, "+3ihSvpsaY0Wt3tAhbVZmTm3dGg="); - })(f$proxy1); + _s(rawComponent, "+3ihSvpsaY0Wt3tAhbVZmTm3dGg="); var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); - var this$21 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); - this.Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$21.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s$proxy1)); + var this$17 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonPC__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); + this.Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$17.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); } export { $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out3.js index 8c10d9a94..445bb788c 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out3.js @@ -6,19 +6,10 @@ import * as $j_japgolly$002escalajs$002ereact$002eReusability from "./japgolly.s import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary from "./japgolly.scalajs.react.hooks.Api$Primary.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Secondary from "./japgolly.scalajs.react.hooks.Api$Secondary.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00241 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$1.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$2.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00243 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$3.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024 from "./japgolly.scalajs.react.hooks.HookComponentBuilder$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024FirstStep from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentP$FirstStep.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024Subsequent from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentP$Subsequent.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2 from "./japgolly.scalajs.react.hooks.HookCtx$P2.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.Hooks$$anon$2.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; -import * as $j_japgolly$002escalajs$002ereact$002epackage$0024 from "./japgolly.scalajs.react.package$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024 from "./japgolly.scalajs.react.vdom.Attr$EventCallback$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; @@ -86,22 +77,7 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$() { return (($$x2 | 0) + ($$x1 | 0) | 0) + (this$3.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; }; - $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$(); - var this$6 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024.$m_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$().apply__Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$First(); - var initialState = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => 123); - var step = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024FirstStep.$c_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$FirstStep(); - var this$8 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useState__F0__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$6, initialState, step); - var initialState$1 = $j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction2__sjs_js_Function2__F2($p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__jsState1__sjs_js_Function2(this)); - var step$1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$1(); - var this$10 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Secondary.$f_Ljapgolly_scalajs_react_hooks_Api$Secondary__useStateBy__O__Ljapgolly_scalajs_react_hooks_Api$SubsequentStep__O(this$8, initialState$1, step$1); - var initialState$2 = $j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction1__sjs_js_Function1__F1(this.Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__f_jsState2); - var step$2 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00242.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$2(); - $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useStateBy__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$10, initialState$2, step$2); - var f$proxy1 = $j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction4__sjs_js_Function4__F4($p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__render__sjs_js_Function4(this)); - new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00243.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$3(); - var s$proxy1 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); - - var rawComponent = ((this$3$1, f$proxy1$2) => { + var rawComponent = (this$2$1 => { var _s = $RefreshSig$(); return _s(props => { @@ -109,19 +85,20 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$() { var hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); - var hook2_raw = $i_react.useState(((this$2$2, props$2, hook1$2) => () => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction2__sjs_js_Function2__F2($p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__jsState1__sjs_js_Function2(this$2$2)).apply__O__O__O(props$2.a, hook1$2)))(this$3$1, props, hook1)); + var hook2_raw = $i_react.useState(((this$2$2, props$2, hook1$2) => () => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction2__sjs_js_Function2__F2($p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__jsState1__sjs_js_Function2(this$2$2)).apply__O__O__O(props$2.a, hook1$2)))(this$2$1, props, hook1)); var hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); var props$1 = props.a; - var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, hook1, hook2); - var hook3_raw = $i_react.useState(((this$3$2, hook3_ctx$2) => () => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction1__sjs_js_Function1__F1(this$3$2.Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__f_jsState2).apply__O__O(hook3_ctx$2)))(this$3$1, hook3_ctx)); + var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$1, hook1, hook2); + var hook3_raw = $i_react.useState(((this$3$1, hook3_ctx$2) => () => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction1__sjs_js_Function1__F1(this$3$1.Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__f_jsState2).apply__O__O(hook3_ctx$2)))(this$2$1, hook3_ctx)); var hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); - return f$proxy1$2.apply__O__O__O__O__O(props.a, hook1, hook2, hook3).rawNode__O(); - }, "FxwR6OmpTOOHvaIwXP2+wyTEVnc="); - })(this, f$proxy1); + return $j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction4__sjs_js_Function4__F4($p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__render__sjs_js_Function4(this$2$1)).apply__O__O__O__O__O(props.a, hook1, hook2, hook3).rawNode__O(); + }, "DGMqY1OYOh7G/wCDYn974GGuAaM="); + })(this); var $$x3 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); - var this$14 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); - this.Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__f_Component = $$x3.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$14.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s$proxy1)); + var this$6 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); + this.Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__f_Component = $$x3.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$6.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); } export { $c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out3.js index 633da63c3..d9637632b 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out3.js @@ -6,26 +6,15 @@ import * as $j_japgolly$002escalajs$002ereact$002eReusability from "./japgolly.s import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary from "./japgolly.scalajs.react.hooks.Api$Primary.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Secondary from "./japgolly.scalajs.react.hooks.Api$Secondary.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00241 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$1.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$2.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00243 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$3.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00244 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$4.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024 from "./japgolly.scalajs.react.hooks.HookComponentBuilder$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024First from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentP$First.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024Subsequent from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentP$Subsequent.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2 from "./japgolly.scalajs.react.hooks.HookCtx$P2.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.Hooks$$anon$2.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; -import * as $j_japgolly$002escalajs$002ereact$002epackage$0024 from "./japgolly.scalajs.react.package$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024 from "./japgolly.scalajs.react.vdom.Attr$EventCallback$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite from "./japgolly.scalajs.react.vdom.TagLite.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagMod from "./japgolly.scalajs.react.vdom.TagMod.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode from "./japgolly.scalajs.react.vdom.VdomNode.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; @@ -33,9 +22,7 @@ import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js" import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; import * as $j_scala$002eFunction1 from "./scala.Function1.js"; import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; -import * as $j_scala$002escalajs$002eruntime$002eAnonFunction2 from "./scala.scalajs.runtime.AnonFunction2.js"; import * as $j_scala$002escalajs$002eruntime$002eAnonFunction4 from "./scala.scalajs.runtime.AnonFunction4.js"; -import * as $j_scala$002escalajs$002eruntime$002eAnonFunction5 from "./scala.scalajs.runtime.AnonFunction5.js"; function $p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__state1__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__I($thiz, p, s) { return p + (s.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; @@ -85,36 +72,8 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$() { var _$4$1 = _$4; return ((_$1$1 + (_$2$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (_$3$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (_$4$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; }); - $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$(); - var this$6 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024.$m_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$().apply__Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$First(); - var initialState = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => 123); - var step = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024First.$c_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$FirstStep(); - var this$8 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useState__F0__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$6, initialState, step); - var initialState$1 = new $j_scala$002escalajs$002eruntime$002eAnonFunction2.$c_sjsr_AnonFunction2((this$4$1 => (p, s) => { - var p$1 = p | 0; - var s$1 = s; - return $p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__state1__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__I(this$4$1, p$1, s$1); - })(this)); - var step$1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$1(); - var this$10 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Secondary.$f_Ljapgolly_scalajs_react_hooks_Api$Secondary__useStateBy__O__Ljapgolly_scalajs_react_hooks_Api$SubsequentStep__O(this$8, initialState$1, step$1); - var initialState$2 = this.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state2; - var step$2 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00242.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$2(); - var this$12 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useStateBy__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$10, initialState$2, step$2); - var initialState$3 = this.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state3; - var step$3 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00243.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$3(); - $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Secondary.$f_Ljapgolly_scalajs_react_hooks_Api$Secondary__useStateBy__O__Ljapgolly_scalajs_react_hooks_Api$SubsequentStep__O(this$12, initialState$3, step$3); - var f$proxy1 = new $j_scala$002escalajs$002eruntime$002eAnonFunction5.$c_sjsr_AnonFunction5((this$5$1 => (p$2, s1, s2, s3, s4) => { - var p$3 = p$2 | 0; - var s1$1 = s1; - var s2$1 = s2; - var s3$1 = s3; - var s4$1 = s4; - return $p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__render__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_vdom_TagOf(this$5$1, p$3, s1$1, s2$1, s3$1, s4$1); - })(this)); - new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00244.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$4(); - var s$proxy1 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); - - var rawComponent = ((this$6$1, f$proxy1$2) => { + + var rawComponent = (this$3$1 => { var _s = $RefreshSig$(); return _s(props => { @@ -124,23 +83,26 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$() { var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); var hook2_raw = $i_react.useState(((this$2$2, props$2, hook1$2) => () => { var $$x3 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); - var p$4 = props$2.a | 0; - return $$x3.apply__O__Ljapgolly_scalajs_react_internal_Box($p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__state1__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__I(this$2$2, p$4, hook1$2)); - })(this$6$1, props, hook1)); + var p = props$2.a | 0; + return $$x3.apply__O__Ljapgolly_scalajs_react_internal_Box($p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__state1__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__I(this$2$2, p, hook1$2)); + })(this$3$1, props, hook1)); var hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); var props$1 = props.a; - var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, hook1, hook2); - var hook3_raw = $i_react.useState(((this$3$2, hook3_ctx$2) => () => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(this$3$2.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state2.apply__O__O(hook3_ctx$2)))(this$6$1, hook3_ctx)); + var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$1, hook1, hook2); + var hook3_raw = $i_react.useState(((this$3$2, hook3_ctx$2) => () => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(this$3$2.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state2.apply__O__O(hook3_ctx$2)))(this$3$1, hook3_ctx)); var hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); - var hook4_raw = $i_react.useState(((this$4$2, props$3, hook1$3, hook2$2, hook3$2) => () => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(this$4$2.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state3.apply__O__O__O__O__O(props$3.a, hook1$3, hook2$2, hook3$2)))(this$6$1, props, hook1, hook2, hook3)); + var hook4_raw = $i_react.useState(((this$4$1, props$3, hook1$3, hook2$2, hook3$2) => () => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(this$4$1.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state3.apply__O__O__O__O__O(props$3.a, hook1$3, hook2$2, hook3$2)))(this$3$1, props, hook1, hook2, hook3)); var hook4 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook4_raw); - return f$proxy1$2.apply__O__O__O__O__O__O(props.a, hook1, hook2, hook3, hook4).rawNode__O(); - }, "utTcF5dA/IeeOyCNxp/nYadVY3U="); - })(this, f$proxy1); + var p$1 = props.a | 0; + var this$6 = $p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__render__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_vdom_TagOf(this$3$1, p$1, hook1, hook2, hook3, hook4); + return this$6.rawElement__Ljapgolly_scalajs_react_facade_React$Element(); + }, "tiTMmuZfNiWpuBAqwIr3FRuMfVQ="); + })(this); var $$x4 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); - var this$16 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); - this.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_Component = $$x4.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$16.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s$proxy1)); + var this$7 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); + this.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_Component = $$x4.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$7.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); } export { $c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out3.js index 5ed2ae950..98a4e53bd 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out3.js @@ -6,25 +6,15 @@ import * as $j_japgolly$002escalajs$002ereact$002eReusability from "./japgolly.s import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary from "./japgolly.scalajs.react.hooks.Api$Primary.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Secondary from "./japgolly.scalajs.react.hooks.Api$Secondary.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00241 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$1.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$2.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00243 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$3.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024 from "./japgolly.scalajs.react.hooks.HookComponentBuilder$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024FirstStep from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentP$FirstStep.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024Subsequent from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentP$Subsequent.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2 from "./japgolly.scalajs.react.hooks.HookCtx$P2.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.Hooks$$anon$2.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; -import * as $j_japgolly$002escalajs$002ereact$002epackage$0024 from "./japgolly.scalajs.react.package$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024 from "./japgolly.scalajs.react.vdom.Attr$EventCallback$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite from "./japgolly.scalajs.react.vdom.TagLite.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagMod from "./japgolly.scalajs.react.vdom.TagMod.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode from "./japgolly.scalajs.react.vdom.VdomNode.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; @@ -32,90 +22,61 @@ import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js" import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; import * as $j_scala$002eFunction1 from "./scala.Function1.js"; import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; -import * as $j_scala$002escalajs$002eruntime$002eAnonFunction2 from "./scala.scalajs.runtime.AnonFunction2.js"; -import * as $j_scala$002escalajs$002eruntime$002eAnonFunction4 from "./scala.scalajs.runtime.AnonFunction4.js"; function $c_Ljapgolly_scalajs_react_test_emissions_UseState$() { + var _s = $RefreshSig$(); + this.Ljapgolly_scalajs_react_test_emissions_UseState$__f_Component = null; $n_Ljapgolly_scalajs_react_test_emissions_UseState$ = this; - $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$(); - var this$4 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024.$m_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$().apply__Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$First(); - var initialState = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => 123); - var step = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024FirstStep.$c_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$FirstStep(); - var this$6 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useState__F0__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$4, initialState, step); - var initialState$1 = new $j_scala$002escalajs$002eruntime$002eAnonFunction2.$c_sjsr_AnonFunction2((p, s1) => { - var p$1 = p | 0; - var s1$1 = s1; - return p$1 + (s1$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; - }); - var step$1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$1(); - var this$10 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Secondary.$f_Ljapgolly_scalajs_react_hooks_Api$Secondary__useStateBy__O__Ljapgolly_scalajs_react_hooks_Api$SubsequentStep__O(this$6, initialState$1, step$1); - var initialState$2 = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(δ => { - var δ$1 = δ; - var $$x2 = δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; - var this$7 = δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; - var $$x1 = this$7.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; - var this$8 = δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; - return (($$x2 | 0) + ($$x1 | 0) | 0) + (this$8.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; - }); - var step$2 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00242.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$2(); - $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useStateBy__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$10, initialState$2, step$2); - var f$proxy1 = new $j_scala$002escalajs$002eruntime$002eAnonFunction4.$c_sjsr_AnonFunction4((_$1, s1$2, s2, s3) => { - var s1$3 = s1$2; - var s2$1 = s2; - var s3$1 = s3; - var sum = ((s1$3.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) + (s2$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (s3$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; - var this$20 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + + var rawComponent = props => { + _s(); + + var hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); + var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); + var hook2_raw = $i_react.useState(((props$2, hook1$2) => () => { + var $$x1 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); + var p = props$2.a | 0; + return $$x1.apply__O__Ljapgolly_scalajs_react_internal_Box(p + (hook1$2.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0); + })(props, hook1)); + var hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); + var props$1 = props.a; + var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$1, hook1, hook2); + var hook3_raw = $i_react.useState((hook3_ctx$2 => () => { + var $$x4 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); + var $$x3 = hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + var this$4 = hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; + var $$x2 = this$4.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; + var this$5 = hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; + return $$x4.apply__O__Ljapgolly_scalajs_react_internal_Box((($$x3 | 0) + ($$x2 | 0) | 0) + (this$5.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0); + })(hook3_ctx)); + var hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); + props.a | 0; + var sum = ((hook1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) + (hook2.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (hook3.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; + var this$14 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); var self = "button"; - var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((s1$2$1 => () => { + var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((hook1$3 => () => { $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); - var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(s1$2$1); + var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(hook1$3); var ev$1 = r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$2 => { var _$2$1 = _$2 | 0; return 1 + _$2$1 | 0; })); return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(ev$1 === null ? null : ev$1.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline); - })(s1$3)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)])); - return $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$20, self, xs); - }); - new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00243.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$3(); - var s$proxy1 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); - - var rawComponent = (f$proxy1$2 => { - var _s = $RefreshSig$(); - - return _s(props => { - _s(); + })(hook1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)])); + var this$15 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$14, self, xs); + return this$15.rawElement__Ljapgolly_scalajs_react_facade_React$Element(); + }; - var hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); - var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); - var hook2_raw = $i_react.useState(((props$2, hook1$2) => () => { - var $$x3 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); - var p$2 = props$2.a | 0; - return $$x3.apply__O__Ljapgolly_scalajs_react_internal_Box(p$2 + (hook1$2.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0); - })(props, hook1)); - var hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); - var props$1 = props.a; - var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, hook1, hook2); - var hook3_raw = $i_react.useState((hook3_ctx$2 => () => { - var $$x6 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); - var $$x5 = hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; - var this$24 = hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; - var $$x4 = this$24.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; - var this$25 = hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; - return $$x6.apply__O__Ljapgolly_scalajs_react_internal_Box((($$x5 | 0) + ($$x4 | 0) | 0) + (this$25.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0); - })(hook3_ctx)); - var hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); - return f$proxy1$2.apply__O__O__O__O__O(props.a, hook1, hook2, hook3).rawNode__O(); - }, "jQdGBdZMpVSjxy9qYSNUEqi9mK0="); - })(f$proxy1); + _s(rawComponent, "EjHC1fPm+wHx9Y3VO9JBQAyBf8s="); - var $$x7 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); - var this$26 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); - this.Ljapgolly_scalajs_react_test_emissions_UseState$__f_Component = $$x7.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$26.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s$proxy1)); + var $$x5 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$16 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); + this.Ljapgolly_scalajs_react_test_emissions_UseState$__f_Component = $$x5.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$16.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); } export { $c_Ljapgolly_scalajs_react_test_emissions_UseState$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out3.js index d3205ac06..1065992a2 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out3.js @@ -5,26 +5,16 @@ import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 fro import * as $j_japgolly$002escalajs$002ereact$002eReusability from "./japgolly.scalajs.react.Reusability.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary from "./japgolly.scalajs.react.hooks.Api$Primary.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00241 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$1.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$2.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00243 from "./japgolly.scalajs.react.hooks.ComponentP_SubsequentSteps$$anon$3.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024 from "./japgolly.scalajs.react.hooks.HookComponentBuilder$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024FirstStep from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentP$FirstStep.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024Subsequent from "./japgolly.scalajs.react.hooks.HookComponentBuilder$ComponentP$Subsequent.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2 from "./japgolly.scalajs.react.hooks.HookCtx$P2.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.Hooks$$anon$2.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuse$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseStateWithReuse$.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF from "./japgolly.scalajs.react.hooks.Hooks$UseStateWithReuseF.js"; import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; -import * as $j_japgolly$002escalajs$002ereact$002epackage$0024 from "./japgolly.scalajs.react.package$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024 from "./japgolly.scalajs.react.vdom.Attr$EventCallback$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite from "./japgolly.scalajs.react.vdom.TagLite.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagMod from "./japgolly.scalajs.react.vdom.TagMod.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode from "./japgolly.scalajs.react.vdom.VdomNode.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; @@ -32,127 +22,82 @@ import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js" import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; import * as $j_scala$002eFunction1 from "./scala.Function1.js"; import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; -import * as $j_scala$002escalajs$002eruntime$002eAnonFunction2 from "./scala.scalajs.runtime.AnonFunction2.js"; -import * as $j_scala$002escalajs$002eruntime$002eAnonFunction4 from "./scala.scalajs.runtime.AnonFunction4.js"; function $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$() { + var _s = $RefreshSig$(); + this.Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$__f_Component = null; $n_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$ = this; - $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$(); - var this$8 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024.$m_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$().apply__Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$First(); - var initialState = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => 123); - var evidence$2 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); - var this$6 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); - var evidence$3 = this$6.by_$eq$eq__F2(); - var step = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookComponentBuilder$0024ComponentP$0024FirstStep.$c_Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$FirstStep(); - var initialState$1 = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1((initialState$2 => _$36 => initialState$2.apply__O())(initialState)); - var f = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((initialState$2$1, evidence$4$2, evidence$5$2) => ctx => $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuse$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuse$().unsafeCreate__F0__F2__s_reflect_ClassTag__Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((initialState$8$2, ctx$2) => () => initialState$8$2.apply__O__O(ctx$2))(initialState$2$1, ctx)), evidence$5$2, evidence$4$2))(initialState$1, evidence$2, evidence$3)); - var this$18 = this$8.next__F1__Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$FirstStep__Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$Subsequent(f, step); - var initialState$3 = new $j_scala$002escalajs$002eruntime$002eAnonFunction2.$c_sjsr_AnonFunction2((p, s1) => { - var p$1 = p | 0; - var s1$1 = s1; - var this$12 = s1$1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - return p$1 + (this$12.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; - }); - var evidence$6 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); - var this$16 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); - var evidence$7 = this$16.by_$eq$eq__F2(); - var step$1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$1(); - var initialState$4 = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((initialState$2$2, step$2) => _$62 => step$2.squash__F1().apply__O__O(initialState$2$2).apply__O__O(_$62))(initialState$3, step$1)); - var f$1 = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((initialState$2$3, evidence$4$2$1, evidence$5$2$1) => ctx$1 => $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuse$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuse$().unsafeCreate__F0__F2__s_reflect_ClassTag__Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((initialState$8$2$1, ctx$2$1) => () => initialState$8$2$1.apply__O__O(ctx$2$1))(initialState$2$3, ctx$1)), evidence$5$2$1, evidence$4$2$1))(initialState$4, evidence$6, evidence$7)); - var this$31 = this$18.next__F1__Ljapgolly_scalajs_react_hooks_HookComponentBuilder$ComponentP$SubsequentStep__O(f$1, step$1); - var initialState$5 = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(δ => { - var δ$1 = δ; - var $$x2 = δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; - var this$22 = δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; - var this$23 = this$22.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - var $$x1 = this$23.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; - var this$24 = δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; - var this$25 = this$24.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - return (($$x2 | 0) + ($$x1 | 0) | 0) + (this$25.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; - }); - var evidence$4 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); - var this$29 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); - var evidence$5 = this$29.by_$eq$eq__F2(); - var step$3 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00242.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$2(); - this$31.next__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((initialState$2$4, evidence$4$2$2, evidence$5$2$2) => ctx$3 => $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuse$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuse$().unsafeCreate__F0__F2__s_reflect_ClassTag__Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((initialState$8$2$2, ctx$2$2) => () => initialState$8$2$2.apply__O__O(ctx$2$2))(initialState$2$4, ctx$3)), evidence$5$2$2, evidence$4$2$2))(initialState$5, evidence$4, evidence$5)), step$3); - var f$proxy1 = new $j_scala$002escalajs$002eruntime$002eAnonFunction4.$c_sjsr_AnonFunction4((_$1, s1$2, s2, s3) => { - var s1$3 = s1$2; - var s2$1 = s2; - var s3$1 = s3; - var this$34 = s1$3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - var $$x4 = this$34.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; - var this$35 = s2$1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - var $$x3 = this$35.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; - var this$36 = s3$1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - var sum = (($$x4 | 0) + ($$x3 | 0) | 0) + (this$36.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; - var this$45 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + + var rawComponent = props => { + _s(); + + var hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); + var this$3 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var r = this$3.by_$eq$eq__F2(); + var ct = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var rr = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r); + var this$8 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); + var us = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$8, r); + var hook1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us, rr, ct); + var hook2_raw = $i_react.useState(((props$2, hook1$2) => () => { + var $$x1 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); + var p = props$2.a | 0; + var this$10 = hook1$2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + return $$x1.apply__O__Ljapgolly_scalajs_react_internal_Box(p + (this$10.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0); + })(props, hook1)); + var this$11 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var r$1 = this$11.by_$eq$eq__F2(); + var ct$1 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var rr$1 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r$1); + var this$16 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); + var us$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$16, r$1); + var hook2 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us$1, rr$1, ct$1); + var props$1 = props.a; + var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$1, hook1, hook2); + var hook3_raw = $i_react.useState((hook3_ctx$2 => () => { + var $$x4 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); + var $$x3 = hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + var this$19 = hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; + var this$20 = this$19.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var $$x2 = this$20.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; + var this$21 = hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; + var this$22 = this$21.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + return $$x4.apply__O__Ljapgolly_scalajs_react_internal_Box((($$x3 | 0) + ($$x2 | 0) | 0) + (this$22.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0); + })(hook3_ctx)); + var this$23 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var r$2 = this$23.by_$eq$eq__F2(); + var ct$2 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var rr$2 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r$2); + var this$28 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); + var us$2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$28, r$2); + var hook3 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us$2, rr$2, ct$2); + props.a | 0; + var this$30 = hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var $$x6 = this$30.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; + var this$31 = hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var $$x5 = this$31.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; + var this$32 = hook3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var sum = (($$x6 | 0) + ($$x5 | 0) | 0) + (this$32.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; + var this$40 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); var self = "button"; - var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("DEBUG = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((s1$2$1 => () => s1$2$1.modState__F1__Ljapgolly_scalajs_react_Reusable(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$2 => { + var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("DEBUG = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((hook1$3 => () => hook1$3.modState__F1__Ljapgolly_scalajs_react_Reusable(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$2 => { var _$2$1 = _$2 | 0; return 1 + _$2$1 | 0; - })))(s1$3)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().reusableDefaultSync__F1())])); - return $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$45, self, xs); - }); - new $j_japgolly$002escalajs$002ereact$002ehooks$002eComponentP$005fSubsequentSteps$0024$0024anon$00243.$c_Ljapgolly_scalajs_react_hooks_ComponentP_SubsequentSteps$$anon$3(); - var s$proxy1 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); - - var rawComponent = (f$proxy1$2 => { - var _s = $RefreshSig$(); - - return _s(props => { - _s(); + })))(hook1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().reusableDefaultSync__F1())])); + var this$41 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$40, self, xs); + return this$41.rawElement__Ljapgolly_scalajs_react_facade_React$Element(); + }; - var hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); - var this$48 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); - var r = this$48.by_$eq$eq__F2(); - var ct = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); - var rr = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r); - var this$53 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); - var us = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$53, r); - var hook1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us, rr, ct); - var hook2_raw = $i_react.useState(((props$2, hook1$2) => () => { - var $$x5 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); - var p$2 = props$2.a | 0; - var this$55 = hook1$2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - return $$x5.apply__O__Ljapgolly_scalajs_react_internal_Box(p$2 + (this$55.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0); - })(props, hook1)); - var this$56 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); - var r$1 = this$56.by_$eq$eq__F2(); - var ct$1 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); - var rr$1 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r$1); - var this$61 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); - var us$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$61, r$1); - var hook2 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us$1, rr$1, ct$1); - var props$1 = props.a; - var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, hook1, hook2); - var hook3_raw = $i_react.useState((hook3_ctx$2 => () => { - var $$x8 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); - var $$x7 = hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; - var this$64 = hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; - var this$65 = this$64.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - var $$x6 = this$65.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; - var this$66 = hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; - var this$67 = this$66.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - return $$x8.apply__O__Ljapgolly_scalajs_react_internal_Box((($$x7 | 0) + ($$x6 | 0) | 0) + (this$67.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0); - })(hook3_ctx)); - var this$68 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); - var r$2 = this$68.by_$eq$eq__F2(); - var ct$2 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); - var rr$2 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r$2); - var this$73 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); - var us$2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$73, r$2); - var hook3 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us$2, rr$2, ct$2); - return f$proxy1$2.apply__O__O__O__O__O(props.a, hook1, hook2, hook3).rawNode__O(); - }, "rdPtgGYg2x5mCMwXQexQFncti08="); - })(f$proxy1); + _s(rawComponent, "+059i36eGzSqNFL1PwYIRLAIpQ4="); - var $$x9 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); - var this$75 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); - this.Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$__f_Component = $$x9.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$75.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s$proxy1)); + var $$x7 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$42 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); + this.Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$__f_Component = $$x7.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$42.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); } export { $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$ }; From 6f16bcb588bd88c0c5756407e1d66a7eea074845 Mon Sep 17 00:00:00 2001 From: David Barri Date: Thu, 16 Jun 2022 16:27:10 +1000 Subject: [PATCH 49/72] Make `Hook{Defn,Step}` static --- .../scalajs/react/hooks/HookMacros.scala | 6 ++--- .../react/hooks/AbstractHookMacros.scala | 26 +++++++++++-------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala index 64417056b..87004b12d 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala @@ -213,7 +213,7 @@ object HookMacros { import quotes.reflect.* val hookMacros = HookMacrosImpl(q) - import hookMacros.{log, HookStep} + import hookMacros.log log.enabled = debug // f.show.contains("DEBUG") log.header() @@ -224,8 +224,8 @@ object HookMacros { log("self", macroApplication.show) - val renderStep = - HookStep("renderRR", Nil, List(List(f.asTerm), List(step.asTerm, s.asTerm))) + val renderStep: hookMacros.HookStep = + AbstractHookMacros.HookStep("renderRR", Nil, List(List(f.asTerm), List(step.asTerm, s.asTerm))) val rewriteAttempt = for { diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala index f567a279c..5d774579b 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala @@ -9,6 +9,16 @@ import scala.reflect.ClassTag object AbstractHookMacros { + final case class HookDefn[Term, TypeTree](steps: Vector[HookStep[Term, TypeTree]]) { + def +(s: HookStep[Term, TypeTree]): HookDefn[Term, TypeTree] = + HookDefn(steps :+ s) + } + + final case class HookStep[Term, TypeTree](name: String, targs: List[TypeTree], args: List[List[Term]]) { + def sig = (targs, args) + } + + // =================================================================================================================== // Hook Rewriter @@ -121,7 +131,7 @@ object AbstractHookMacros { // ===================================================================================================================== trait AbstractHookMacros { - import AbstractHookMacros._ + import AbstractHookMacros.HookRewriter type Expr[A] type Ref @@ -176,15 +186,9 @@ trait AbstractHookMacros { // ------------------------------------------------------------------------------------------------------------------- // Concrete - case class HookDefn(steps: Vector[HookStep]) { - def +(s: HookStep): HookDefn = - HookDefn(steps :+ s) - } - - case class HookStep(name: String, targs: List[TypeTree], args: List[List[Term]]) { - def sig = (targs, args) - } + final type HookDefn = AbstractHookMacros.HookDefn[Term, TypeTree] + final type HookStep = AbstractHookMacros.HookStep[Term, TypeTree] final type Rewriter = HookRewriter[Stmt, Term, Ref] final type RewriterBridge = HookRewriter.Bridge[Stmt, Term, Ref] final type RewriterCtx = HookRewriter.InitialCtx[Stmt, Term] @@ -244,9 +248,9 @@ trait AbstractHookMacros { if (args.nonEmpty) Left(() => s"$withHooks called with args when none exepcted: ${args.map(_.map(showCode(_)))}") else - Right(HookDefn(steps.toVector)) + Right(AbstractHookMacros.HookDefn(steps.toVector)) } else { - val step = HookStep(name, targs, args) + val step = AbstractHookMacros.HookStep(name, targs, args) log(s"Found step '$name'", step) _parse(t, Nil, Nil, step :: steps) } From 729ef6d0d4cd00739334837955680afabb389bd2 Mon Sep 17 00:00:00 2001 From: David Barri Date: Fri, 17 Jun 2022 11:44:49 +1000 Subject: [PATCH 50/72] Support RR on the hooks primary API --- .../scalajs/react/hooks/HookMacros.scala | 46 +++++-- .../react/hooks/HookMacrosTraits.scala | 12 +- .../scalajs/react/hooks/HookMacros.scala | 112 ++++++++++++++++-- .../react/hooks/HookMacrosTraits.scala | 31 ++++- .../react/hooks/AbstractHookMacros.scala | 14 ++- .../japgolly/scalajs/react/hooks/Api.scala | 2 +- .../test/emissions/UseStateWithReuse.scala | 12 +- .../test/resources/rr-sjr/CustomHooks-out3.js | 2 +- .../resources/rr-sjr/CustomHooksBy-out2.js | 2 +- .../resources/rr-sjr/CustomHooksBy-out3.js | 4 +- .../rr-sjr/HooksWithChildren-out2.js | 4 +- .../rr-sjr/HooksWithChildren-out3.js | 8 +- .../resources/rr-sjr/HooksWithJsFns-out2.js | 6 +- .../resources/rr-sjr/HooksWithJsFns-out3.js | 10 +- .../rr-sjr/HooksWithScalaFns-out2.js | 6 +- .../rr-sjr/HooksWithScalaFns-out3.js | 10 +- .../test/resources/rr-sjr/UseState-out2.js | 6 +- .../test/resources/rr-sjr/UseState-out3.js | 10 +- .../rr-sjr/UseStateWithReuse-out2.js | 52 ++++---- .../rr-sjr/UseStateWithReuse-out3.js | 67 +++++------ .../scalajs/react/core/HooksRRTest.scala | 9 +- .../scalajs/react/core/HooksTest.scala | 9 +- 22 files changed, 296 insertions(+), 138 deletions(-) diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala index 99242a9e8..7003a4165 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -9,6 +9,21 @@ import scala.reflect.macros.blackbox.Context class HookMacros(val c: Context) extends MacroUtils { import c.universe._ + def render1[P, C <: Children] + (f: c.Tree)(s: c.Tree) + (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = + _render1(f, s, false)(P, C) + + def renderDebug1[P, C <: Children] + (f: c.Tree)(s: c.Tree) + (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = + _render1(f, s, true)(P, C) + + private def _render1[P, C <: Children] + (f: c.Tree, s: c.Tree, debug: Boolean) + (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = + _render[P, C](f, None, s, debug) + def render2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] (f: c.Tree)(step: c.Tree, s: c.Tree) (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = @@ -19,6 +34,11 @@ class HookMacros(val c: Context) extends MacroUtils { (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = _render2(f, step, s, true)(P, C) + private def _render2[P, C <: Children] + (f: c.Tree, step: c.Tree, s: c.Tree, debug: Boolean) + (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = + _render[P, C](f, Some(step), s, debug) + // =================================================================================================================== private implicit def autoTagToType[A](t: c.WeakTypeTag[A]): Type = t.tpe @@ -153,9 +173,9 @@ class HookMacros(val c: Context) extends MacroUtils { // =================================================================================================================== - def _render2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] - (f: c.Tree, step: c.Tree, s: c.Tree, debug: Boolean) - (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = { + def _render[P, C <: Children] + (f: c.Tree, stepOption: Option[c.Tree], s: c.Tree, debug: Boolean) + (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = { val hookMacros = new HookMacrosImpl @@ -185,12 +205,22 @@ class HookMacros(val c: Context) extends MacroUtils { """) case Left(err) => - c.warning(c.enclosingPosition, err()) + val msg = err() + import Console._ + log(RED_B + WHITE + "Giving up. " + msg + RESET) + c.warning(c.enclosingPosition, msg) + val self = c.prefix - q""" - val f = $step.squash($f) - $self.render(f)($s) - """ + + stepOption match { + case Some(step) => + q""" + val f = $step.squash($f) + $self.render(f)($s) + """ + case None => + q"$self.render($f)($s)" + } } log.footer(showCode(result)) diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacrosTraits.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacrosTraits.scala index 7284e8a58..f9f5aa93f 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacrosTraits.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacrosTraits.scala @@ -6,8 +6,18 @@ import japgolly.scalajs.react.internal.Box import japgolly.scalajs.react.vdom.VdomNode import japgolly.scalajs.react.{Children, CtorType} +trait ApiPrimaryWithRenderMacros[P, C <: Children, Ctx, Step <: AbstractStep] { + self: PrimaryWithRender[P, C, Ctx, Step] => + + final def renderRR(f: Ctx => VdomNode)(implicit s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = + macro HookMacros.render1[P, C] + + final def renderRRDebug(f: Ctx => VdomNode)(implicit s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = + macro HookMacros.renderDebug1[P, C] +} + trait ApiSecondaryWithRenderMacros[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] { - self: PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step] => + self: PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step] => final def renderRR(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = macro HookMacros.render2[P, C, Ctx, CtxFn, Step] diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala index 87004b12d..a89310990 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala @@ -18,6 +18,45 @@ import scala.scalajs.js object HookMacros { + type PrimaryProxy[P, C <: Children, Ctx, Step <: AbstractStep] = + ApiPrimaryWithRenderMacros[P, C, Ctx, Step] + + type PrimaryApi[P, C <: Children, Ctx, Step <: AbstractStep] = + PrimaryWithRender[P, C, Ctx, Step] + + // https://github.com/lampepfl/dotty/issues/15357 + inline def render1Workaround[ + P, C <: Children, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u] + ](inline proxy: PrimaryProxy[P, C, Ctx, Step], + inline f : Ctx => VdomNode, + inline s : CtorType.Summoner.Aux[Box[P], C, CT], + ): Component[P, CT] = + ${ render1[P, C, Ctx, Step, CT]('proxy, 'f, 's) } + + inline def renderDebug1Workaround[ + P, C <: Children, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u] + ](inline proxy: PrimaryProxy[P, C, Ctx, Step], + inline f : Ctx => VdomNode, + inline s : CtorType.Summoner.Aux[Box[P], C, CT], + ): Component[P, CT] = + ${ renderDebug1[P, C, Ctx, Step, CT]('proxy, 'f, 's) } + + def render1[P, C <: Children, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]] + (proxy: Expr[PrimaryProxy[P, C, Ctx, Step]], + f : Expr[Ctx => VdomNode], + s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], + )(using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], Step: Type[Step]): Expr[Component[P, CT]] = + _render1(proxy, f, s, false) + + def renderDebug1[P, C <: Children, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]] + (proxy: Expr[PrimaryProxy[P, C, Ctx, Step]], + f : Expr[Ctx => VdomNode], + s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], + )(using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], Step: Type[Step]): Expr[Component[P, CT]] = + _render1(proxy, f, s, true) + + // =================================================================================================================== + type SecondaryProxy[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] = ApiSecondaryWithRenderMacros[P, C, Ctx, CtxFn, Step] @@ -154,6 +193,7 @@ object HookMacros { } override val FunctionLike = new FunctionExtractor { + @tailrec override def unapply(function: Term) = function match { case Apply(TypeApply(f, args), _) if f.tpe.show.startsWith("scala.scalajs.js.Any.toFunction") => @@ -162,6 +202,13 @@ object HookMacros { case Block(List(DefDef(_, List(TermParamClause(params)), _, Some(_))), Closure(Ident(_), _)) => Some(params.size) + case Block(Nil, expr) => + unapply(expr) + + case Block(stmts1, Block(stmts2, expr)) => + val stmts = if (stmts2.isEmpty) stmts1 else stmts1 ::: stmts2 + unapply(Block(stmts, expr)) + case i@ Ident(_) => i.symbol.tree match { case d: DefDef => byTypeRepr(d.returnTpt.tpe) @@ -202,6 +249,28 @@ object HookMacros { // =================================================================================================================== + import AbstractHookMacros.HookStep + + def _render1[P, C <: Children, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]] + (proxy: Expr[PrimaryProxy[P, C, Ctx, Step]], + f : Expr[Ctx => VdomNode], + s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], + debug: Boolean, + )(using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], Step: Type[Step]): Expr[Component[P, CT]] = { + + import quotes.reflect.* + + val self = proxy.asInstanceOf[Expr[PrimaryApi[P, C, Ctx, Step]]] + + _render[P, C, CT]( + macroApplication = self.asTerm, + s = s, + debug = debug, + renderStep = HookStep("renderRR", Nil, List(List(f.asTerm), List(s.asTerm))), + giveUp = () => '{ $self.render($f)($s) }, + ) + } + def _render2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]] (proxy: Expr[SecondaryProxy[P, C, Ctx, CtxFn, Step]], f : Expr[CtxFn[VdomNode]], @@ -212,20 +281,36 @@ object HookMacros { import quotes.reflect.* - val hookMacros = HookMacrosImpl(q) - import hookMacros.log + val self = proxy.asInstanceOf[Expr[SecondaryApi[P, C, Ctx, CtxFn, Step]]] - log.enabled = debug // f.show.contains("DEBUG") - log.header() + _render[P, C, CT]( + macroApplication = self.asTerm, + s = s, + debug = debug, + renderStep = HookStep("renderRR", Nil, List(List(f.asTerm), List(step.asTerm, s.asTerm))), + giveUp = () => '{ $self.render($step.squash($f)(_))($s) }, + ) + } - val self = proxy.asInstanceOf[Expr[SecondaryApi[P, C, Ctx, CtxFn, Step]]] + // =================================================================================================================== - val macroApplication = self.asTerm + private def _render[P, C <: Children, CT[-p, +u] <: CtorType[p, u]] + (using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT]) + (macroApplication: q.reflect.Term, + s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], + debug : Boolean, + renderStep : HookStep[q.reflect.Term, q.reflect.TypeTree], + giveUp : () => Expr[Component[P, CT]], + ): Expr[Component[P, CT]] = { + + import quotes.reflect.* - log("self", macroApplication.show) + val hookMacros = HookMacrosImpl(q) - val renderStep: hookMacros.HookStep = - AbstractHookMacros.HookStep("renderRR", Nil, List(List(f.asTerm), List(step.asTerm, s.asTerm))) + import hookMacros.log + log.enabled = debug + log.header() + // log("self", macroApplication.show) val rewriteAttempt = for { @@ -255,8 +340,13 @@ object HookMacros { } case Left(err) => - report.warning(err()) - '{ $self.render($step.squash($f)(_))($s) } + val msg = err() + import Console._ + log(RED_B + WHITE + "Giving up. " + msg + RESET) + + report.warning(msg) + + giveUp() } log.footer(result.show) diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala index 086f2ca28..6efa8531a 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala @@ -15,12 +15,29 @@ import scala.quoted.* import scala.reflect.ClassTag import scala.scalajs.js -trait ApiSecondaryWithRenderMacros[P, C <: Children, Ctx, CtxFn[_], _Step <: SubsequentStep[Ctx, CtxFn]] { - self: PrimaryWithRender[P, C, Ctx, _Step] with Secondary[Ctx, CtxFn, _Step] => +trait ApiPrimaryWithRenderMacros[P, C <: Children, Ctx, Step <: AbstractStep] { + self: PrimaryWithRender[P, C, Ctx, Step] => } -object ApiSecondaryWithRenderMacros { +object ApiPrimaryWithRenderMacros { + extension [P, C <: Children, Ctx, Step <: AbstractStep](inline self: ApiPrimaryWithRenderMacros[P, C, Ctx, Step]) { + + inline def renderRR(inline f: Ctx => VdomNode)(implicit inline s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = + HookMacros.render1Workaround[P, C, Ctx, Step, s.CT](self, f, s) + + inline def renderRRDebug(inline f: Ctx => VdomNode)(implicit inline s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = + HookMacros.renderDebug1Workaround[P, C, Ctx, Step, s.CT](self, f, s) + } +} + +// ===================================================================================================================== +trait ApiSecondaryWithRenderMacros[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] + extends ApiPrimaryWithRenderMacros[P, C, Ctx, Step] { + self: PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step] => +} + +object ApiSecondaryWithRenderMacros { extension [P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]](inline self: ApiSecondaryWithRenderMacros[P, C, Ctx, CtxFn, Step]) { inline def renderRR(inline f: CtxFn[VdomNode])(implicit inline step: Step, inline s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = @@ -28,5 +45,13 @@ object ApiSecondaryWithRenderMacros { inline def renderRRDebug(inline f: CtxFn[VdomNode])(implicit inline step: Step, inline s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = HookMacros.renderDebug2Workaround[P, C, Ctx, CtxFn, Step, s.CT](self, f, step, s) + + // Gotta duplicate the primary extensions below due to the way Scala 3 handles overload resolution + + inline def renderRR(inline f: Ctx => VdomNode)(implicit inline s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = + HookMacros.render1Workaround[P, C, Ctx, Step, s.CT](self, f, s) + + inline def renderRRDebug(inline f: Ctx => VdomNode)(implicit inline s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = + HookMacros.renderDebug1Workaround[P, C, Ctx, Step, s.CT](self, f, s) } } diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala index 5d774579b..250cd6704 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala @@ -370,8 +370,18 @@ trait AbstractHookMacros { step.name match { case "renderRR" | "renderRRDebug" => - val List(List(renderFn), _) = step.args : @nowarn - Right(b => call(renderFn, b.args)) + val List(List(fn0), _) = step.args : @nowarn + val fn = uninline(fn0) + fn match { + case FunctionLike(paramCount) => + Right { b => + val args = b.argsOrCtxArg(paramCount) + call(fn, args) + } + + case _ => + Left(() => s"Expected a function, found: ${showRaw(fn)}") + } case _ => Left(() => s"Inlining of render method '${step.name}' not yet supported.") diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Api.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Api.scala index 98b769960..3dee236d1 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Api.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Api.scala @@ -678,7 +678,7 @@ object Api { // =================================================================================================================== - trait PrimaryWithRender[P, C <: Children, Ctx, _Step <: AbstractStep] extends Primary[Ctx, _Step] { + trait PrimaryWithRender[P, C <: Children, Ctx, _Step <: AbstractStep] extends Primary[Ctx, _Step] with ApiPrimaryWithRenderMacros[P, C, Ctx, _Step] { def render(f: Ctx => VdomNode)(implicit s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] final def renderReusable[A](f: Ctx => Reusable[A])(implicit s: CtorType.Summoner[Box[P], C], v: A => VdomNode): Component[P, s.CT] = diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseStateWithReuse.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseStateWithReuse.scala index 4d94a70b3..864d0f4b4 100644 --- a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseStateWithReuse.scala +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseStateWithReuse.scala @@ -3,17 +3,17 @@ package japgolly.scalajs.react.test.emissions import japgolly.scalajs.react._ import japgolly.scalajs.react.vdom.html_<^._ +// This also tests: +// - render with Ctx instead of CtxFn[_] +// - returning a primative as vdom object UseStateWithReuse { val Component = ScalaFnComponent.withHooks[Int] .useStateWithReuse(123) .useStateWithReuseBy((p, s1) => p + s1.value) .useStateWithReuseBy($ => $.props + $.hook1.value + $.hook2.value) - .renderRR { (_, s1, s2, s3) => - val sum = s1.value + s2.value + s3.value - <.button( - "DEBUG = ", sum, - ^.onClick --> s1.modState(_ + 1), - ) + .renderRR { $ => + val sum = $.hook1.value + $.hook2.value + $.hook3.value + sum } } diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out3.js index 5b06117d4..0dc8994dd 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out3.js @@ -11,8 +11,8 @@ import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Arg$0 import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First from "./japgolly.scalajs.react.hooks.CustomHook$Builder$First.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024Subsequent from "./japgolly.scalajs.react.hooks.CustomHook$Builder$Subsequent.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024I1 from "./japgolly.scalajs.react.hooks.HookCtx$I1.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.Hooks$$anon$2.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseEffectArg$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF from "./japgolly.scalajs.react.hooks.Hooks$UseStateF.js"; import * as $j_japgolly$002escalajs$002ereact$002epackage$0024 from "./japgolly.scalajs.react.package$.js"; import * as $j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024 from "./japgolly.scalajs.react.util.EffectCallback$callback$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out2.js index 3d141caff..0de575fc5 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out2.js @@ -82,7 +82,7 @@ $c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$.prototype.japgolly$scal var hook2_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1($m_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$().Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook2, hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]); var hook2 = hook2_raw.apply__O__O(void 0); var props$1 = props.a; - var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$1, hook1, hook2); + var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, hook1, hook2); var $$x2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); var $$x1 = $m_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$().Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook3; var this$2 = hook3_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out3.js index 9266428b8..ac335d4d8 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out3.js @@ -9,7 +9,7 @@ import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Build import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024Subsequent from "./japgolly.scalajs.react.hooks.CustomHook$Builder$Subsequent.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024I1 from "./japgolly.scalajs.react.hooks.HookCtx$I1.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2 from "./japgolly.scalajs.react.hooks.HookCtx$P2.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.Hooks$$anon$2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF from "./japgolly.scalajs.react.hooks.Hooks$UseStateF.js"; import * as $j_japgolly$002escalajs$002ereact$002epackage$0024 from "./japgolly.scalajs.react.package$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; @@ -70,7 +70,7 @@ function $c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$() { var hook2_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1(this$7$1.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook2, hook1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); var hook2 = hook2_raw.apply__O__O(void 0); var props$1 = props.a; - var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$1, hook1, hook2); + var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, hook1, hook2); var $$x2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); var $$x1 = this$7$1.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook3; var this$9 = hook3_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out2.js index 017d6a17f..33909bb80 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out2.js @@ -5,7 +5,7 @@ var _s = $RefreshSig$(); import * as $i_react from "react"; import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; import * as $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024 from "./japgolly.scalajs.react.PropsChildren$.js"; -import * as $j_japgolly$002escalajs$002ereact$002eReusability from "./japgolly.scalajs.react.Reusability.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusable$0024 from "./japgolly.scalajs.react.Reusable$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; @@ -59,7 +59,7 @@ $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$.prototype.japgolly$ $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((hook1$1 => () => { - $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(hook1$1); return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$1$2 => { var x$1 = x$1$2 | 0; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out3.js index a759650f8..7d45cb310 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out3.js @@ -3,12 +3,12 @@ import * as $i_react from "react"; import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; import * as $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024package$0024PropsChildren$0024 from "./japgolly.scalajs.react.PropsChildren$package$PropsChildren$.js"; -import * as $j_japgolly$002escalajs$002ereact$002eReusability from "./japgolly.scalajs.react.Reusability.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusable$0024 from "./japgolly.scalajs.react.Reusable$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.Hooks$$anon$2.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF from "./japgolly.scalajs.react.hooks.Hooks$UseStateF.js"; import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024 from "./japgolly.scalajs.react.vdom.Attr$EventCallback$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; @@ -42,8 +42,8 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$() { $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); var self = "button"; var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((hook1$2 => () => { - $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); - var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(hook1$2); + $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); + var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(hook1$2); var ev$1 = r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$1 => { var _$1$1 = _$1 | 0; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out2.js index 82860ec01..3ca783af8 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out2.js @@ -4,7 +4,7 @@ var _s = $RefreshSig$(); import * as $i_react from "react"; import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; -import * as $j_japgolly$002escalajs$002ereact$002eReusability from "./japgolly.scalajs.react.Reusability.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusable$0024 from "./japgolly.scalajs.react.Reusable$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; @@ -93,7 +93,7 @@ $c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$.prototype.japgolly$sca $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((s1$1 => () => { - $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(s1$1); return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$3$2 => { var x$3 = x$3$2 | 0; @@ -122,7 +122,7 @@ $c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$.prototype.japgolly$sca var hook2_raw = $i_react.useState(((props$1, hook1$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$().japgolly$scalajs$react$test$emissions$HooksWithJsFns$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box(props$1, hook1$1))(props, hook1)); var hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); var props$2 = props.a; - var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$2, hook1, hook2); + var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$2, hook1, hook2); var hook3_raw = $i_react.useState((hook3_ctx$1 => () => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$().japgolly$scalajs$react$test$emissions$HooksWithJsFns$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box(hook3_ctx$1))(hook3_ctx)); var hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); return $j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction4__sjs_js_Function4__F4($p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__render__sjs_js_Function4($m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$())).apply__O__O__O__O__O(props.a, hook1, hook2, hook3).rawNode__sjs_js_$bar(); diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out3.js index 445bb788c..a8152d504 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out3.js @@ -2,13 +2,13 @@ import * as $i_react from "react"; import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; -import * as $j_japgolly$002escalajs$002ereact$002eReusability from "./japgolly.scalajs.react.Reusability.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusable$0024 from "./japgolly.scalajs.react.Reusable$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2 from "./japgolly.scalajs.react.hooks.HookCtx$P2.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.Hooks$$anon$2.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF from "./japgolly.scalajs.react.hooks.Hooks$UseStateF.js"; import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024 from "./japgolly.scalajs.react.vdom.Attr$EventCallback$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; @@ -48,8 +48,8 @@ function $p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__render__sjs_ $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); var self = "button"; var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((s1$2 => () => { - $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); - var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(s1$2); + $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); + var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(s1$2); var ev$1 = r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$3 => { var _$3$1 = _$3 | 0; @@ -88,7 +88,7 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$() { var hook2_raw = $i_react.useState(((this$2$2, props$2, hook1$2) => () => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction2__sjs_js_Function2__F2($p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__jsState1__sjs_js_Function2(this$2$2)).apply__O__O__O(props$2.a, hook1$2)))(this$2$1, props, hook1)); var hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); var props$1 = props.a; - var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$1, hook1, hook2); + var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, hook1, hook2); var hook3_raw = $i_react.useState(((this$3$1, hook3_ctx$2) => () => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction1__sjs_js_Function1__F1(this$3$1.Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__f_jsState2).apply__O__O(hook3_ctx$2)))(this$2$1, hook3_ctx)); var hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); return $j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction4__sjs_js_Function4__F4($p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__render__sjs_js_Function4(this$2$1)).apply__O__O__O__O__O(props.a, hook1, hook2, hook3).rawNode__O(); diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out2.js index d9080ec61..49cda9f3b 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out2.js @@ -4,7 +4,7 @@ var _s = $RefreshSig$(); import * as $i_react from "react"; import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; -import * as $j_japgolly$002escalajs$002ereact$002eReusability from "./japgolly.scalajs.react.Reusability.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusable$0024 from "./japgolly.scalajs.react.Reusable$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; @@ -38,7 +38,7 @@ function $p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__render__I $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((s1$1 => () => { - $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(s1$1); return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$5$2 => { var x$5 = x$5$2 | 0; @@ -111,7 +111,7 @@ $c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$.prototype.japgolly$ var hook2_raw = $i_react.useState(((props$1, hook1$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$().japgolly$scalajs$react$test$emissions$HooksWithScalaFns$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box(props$1, hook1$1))(props, hook1)); var hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); var props$2 = props.a; - var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$2, hook1, hook2); + var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$2, hook1, hook2); var hook3_raw = $i_react.useState((hook3_ctx$1 => () => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$().japgolly$scalajs$react$test$emissions$HooksWithScalaFns$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box(hook3_ctx$1))(hook3_ctx)); var hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); var hook4_raw = $i_react.useState(((props$1$1, hook1$1$1, hook2$1, hook3$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$().japgolly$scalajs$react$test$emissions$HooksWithScalaFns$$$anonfun$Component$5__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box(props$1$1, hook1$1$1, hook2$1, hook3$1))(props, hook1, hook2, hook3)); diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out3.js index d9637632b..10477268d 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out3.js @@ -2,13 +2,13 @@ import * as $i_react from "react"; import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; -import * as $j_japgolly$002escalajs$002ereact$002eReusability from "./japgolly.scalajs.react.Reusability.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusable$0024 from "./japgolly.scalajs.react.Reusable$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2 from "./japgolly.scalajs.react.hooks.HookCtx$P2.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.Hooks$$anon$2.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF from "./japgolly.scalajs.react.hooks.Hooks$UseStateF.js"; import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024 from "./japgolly.scalajs.react.vdom.Attr$EventCallback$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; @@ -37,8 +37,8 @@ function $p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__render__I $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); var self = "button"; var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((s1$2 => () => { - $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); - var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(s1$2); + $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); + var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(s1$2); var ev$1 = r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$5 => { var _$5$1 = _$5 | 0; @@ -88,7 +88,7 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$() { })(this$3$1, props, hook1)); var hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); var props$1 = props.a; - var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$1, hook1, hook2); + var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, hook1, hook2); var hook3_raw = $i_react.useState(((this$3$2, hook3_ctx$2) => () => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(this$3$2.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state2.apply__O__O(hook3_ctx$2)))(this$3$1, hook3_ctx)); var hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); var hook4_raw = $i_react.useState(((this$4$1, props$3, hook1$3, hook2$2, hook3$2) => () => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(this$4$1.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state3.apply__O__O__O__O__O(props$3.a, hook1$3, hook2$2, hook3$2)))(this$3$1, props, hook1, hook2, hook3)); diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out2.js index 7161c0fd1..591d4fb47 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out2.js @@ -4,7 +4,7 @@ var _s = $RefreshSig$(); import * as $i_react from "react"; import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; -import * as $j_japgolly$002escalajs$002ereact$002eReusability from "./japgolly.scalajs.react.Reusability.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusable$0024 from "./japgolly.scalajs.react.Reusable$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; @@ -70,7 +70,7 @@ $c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype.japgolly$scalajs$r var hook2_raw = $i_react.useState(((props$1, hook1$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_UseState$().japgolly$scalajs$react$test$emissions$UseState$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box(props$1, hook1$1))(props, hook1)); var hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); var props$2 = props.a; - var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$2, hook1, hook2); + var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$2, hook1, hook2); var hook3_raw = $i_react.useState((hook3_ctx$1 => () => $m_Ljapgolly_scalajs_react_test_emissions_UseState$().japgolly$scalajs$react$test$emissions$UseState$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box(hook3_ctx$1))(hook3_ctx)); var hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); var sum = ((hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) + (hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (hook3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0; @@ -78,7 +78,7 @@ $c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype.japgolly$scalajs$r $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((hook1$2 => () => { - $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(hook1$2); return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$2$2 => { var x$2 = x$2$2 | 0; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out3.js index 98a4e53bd..3e30171ff 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out3.js @@ -2,13 +2,13 @@ import * as $i_react from "react"; import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; -import * as $j_japgolly$002escalajs$002ereact$002eReusability from "./japgolly.scalajs.react.Reusability.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusable$0024 from "./japgolly.scalajs.react.Reusable$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2 from "./japgolly.scalajs.react.hooks.HookCtx$P2.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.Hooks$$anon$2.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF from "./japgolly.scalajs.react.hooks.Hooks$UseStateF.js"; import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024 from "./japgolly.scalajs.react.vdom.Attr$EventCallback$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; @@ -41,7 +41,7 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseState$() { })(props, hook1)); var hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); var props$1 = props.a; - var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$1, hook1, hook2); + var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, hook1, hook2); var hook3_raw = $i_react.useState((hook3_ctx$2 => () => { var $$x4 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); var $$x3 = hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; @@ -58,8 +58,8 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseState$() { $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); var self = "button"; var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((hook1$3 => () => { - $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); - var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(hook1$3); + $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); + var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(hook1$3); var ev$1 = r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$2 => { var _$2$1 = _$2 | 0; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out2.js index dd455f4df..b17402c3e 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out2.js @@ -5,26 +5,21 @@ var _s = $RefreshSig$(); import * as $i_react from "react"; import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; import * as $j_japgolly$002escalajs$002ereact$002eReusability from "./japgolly.scalajs.react.Reusability.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusable$0024 from "./japgolly.scalajs.react.Reusable$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2 from "./japgolly.scalajs.react.hooks.HookCtx$P2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P3 from "./japgolly.scalajs.react.hooks.HookCtx$P3.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF from "./japgolly.scalajs.react.hooks.Hooks$UseStateF.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF from "./japgolly.scalajs.react.hooks.Hooks$UseStateWithReuseF.js"; import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 from "./japgolly.scalajs.react.internal.Singleton$.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024 from "./japgolly.scalajs.react.vdom.Attr$EventCallback$.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement from "./japgolly.scalajs.react.vdom.VdomElement.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; -import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; -import * as $j_scala$002eFunction1 from "./scala.Function1.js"; -import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; -import * as $j_scala$002escalajs$002eruntime$002eWrappedVarArgs from "./scala.scalajs.runtime.WrappedVarArgs.js"; +import * as $j_scala$002ereflect$002eManifestFactory$0024IntManifest$0024 from "./scala.reflect.ManifestFactory$IntManifest$.js"; function $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$() { this.Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$__f_Component = null; @@ -74,44 +69,43 @@ $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$.prototype.japgolly$ }); var this$2 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); var r = this$2.by_$eq$eq__F2(); - var ct = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); - var rr = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r); + var ct = $j_scala$002ereflect$002eManifestFactory$0024IntManifest$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var rr = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r); var this$6 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); var us = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$6, r); var hook1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us, rr, ct); var hook2_raw = $i_react.useState(((props$1, hook1$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$().japgolly$scalajs$react$test$emissions$UseStateWithReuse$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__Ljapgolly_scalajs_react_internal_Box(props$1, hook1$1))(props, hook1)); var this$7 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); var r$1 = this$7.by_$eq$eq__F2(); - var ct$1 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); - var rr$1 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r$1); + var ct$1 = $j_scala$002ereflect$002eManifestFactory$0024IntManifest$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var rr$1 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r$1); var this$11 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); var us$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$11, r$1); var hook2 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us$1, rr$1, ct$1); var props$2 = props.a; - var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$2, hook1, hook2); + var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$2, hook1, hook2); var hook3_raw = $i_react.useState((hook3_ctx$1 => () => $m_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$().japgolly$scalajs$react$test$emissions$UseStateWithReuse$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box(hook3_ctx$1))(hook3_ctx)); var this$13 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); var r$2 = this$13.by_$eq$eq__F2(); - var ct$2 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); - var rr$2 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r$2); + var ct$2 = $j_scala$002ereflect$002eManifestFactory$0024IntManifest$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var rr$2 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r$2); var this$17 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); var us$2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$17, r$2); var hook3 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us$2, rr$2, ct$2); - var this$18 = hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - var $$x2 = this$18.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]; - var this$19 = hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - var $$x1 = this$19.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]; - var this$20 = hook3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - var sum = (($$x2 | 0) + ($$x1 | 0) | 0) + (this$20.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0; - var $$x3 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + var props$3 = props.a; + var hook4_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P3.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P3(props$3, hook1, hook2, hook3); + var this$19 = hook4_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; + var this$20 = this$19.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var $$x2 = this$20.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]; + var this$21 = hook4_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; + var this$22 = this$21.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var $$x1 = this$22.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]; + var this$23 = hook4_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P3__f_hook3; + var this$24 = this$23.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var sum = (($$x2 | 0) + ($$x1 | 0) | 0) + (this$24.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0; $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); - $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); - var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("DEBUG = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((hook1$2 => () => hook1$2.modState__F1__Ljapgolly_scalajs_react_Reusable(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$2$2 => { - var x$2 = x$2$2 | 0; - return 1 + x$2 | 0; - })))(hook1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().reusableDefaultSync__F1())]; - var this$32 = $$x3.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("button", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); - return $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement.$f_Ljapgolly_scalajs_react_vdom_VdomElement__rawNode__sjs_js_$bar(this$32); + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + return new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; }, "w7T9geXFnWi06+mB1Hyj8CKB8Kk="); var $d_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$ = new $j_java$002elang$002eObject.$TypeData().initClass({ Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$: 0 diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out3.js index 1065992a2..1ecaeef85 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out3.js @@ -3,25 +3,20 @@ import * as $i_react from "react"; import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; import * as $j_japgolly$002escalajs$002ereact$002eReusability from "./japgolly.scalajs.react.Reusability.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusable$0024 from "./japgolly.scalajs.react.Reusable$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2 from "./japgolly.scalajs.react.hooks.HookCtx$P2.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242 from "./japgolly.scalajs.react.hooks.Hooks$$anon$2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P3 from "./japgolly.scalajs.react.hooks.HookCtx$P3.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF from "./japgolly.scalajs.react.hooks.Hooks$UseStateF.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF from "./japgolly.scalajs.react.hooks.Hooks$UseStateWithReuseF.js"; import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024 from "./japgolly.scalajs.react.vdom.Attr$EventCallback$.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite from "./japgolly.scalajs.react.vdom.TagLite.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagMod from "./japgolly.scalajs.react.vdom.TagMod.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; -import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; -import * as $j_scala$002eFunction1 from "./scala.Function1.js"; -import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; +import * as $j_scala$002ereflect$002eManifestFactory$0024IntManifest$0024 from "./scala.reflect.ManifestFactory$IntManifest$.js"; function $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$() { var _s = $RefreshSig$(); @@ -35,10 +30,10 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$() { var hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); var this$3 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); var r = this$3.by_$eq$eq__F2(); - var ct = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); - var rr = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r); + var ct = $j_scala$002ereflect$002eManifestFactory$0024IntManifest$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var rr = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r); var this$8 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); - var us = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$8, r); + var us = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$8, r); var hook1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us, rr, ct); var hook2_raw = $i_react.useState(((props$2, hook1$2) => () => { var $$x1 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); @@ -48,13 +43,13 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$() { })(props, hook1)); var this$11 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); var r$1 = this$11.by_$eq$eq__F2(); - var ct$1 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); - var rr$1 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r$1); + var ct$1 = $j_scala$002ereflect$002eManifestFactory$0024IntManifest$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var rr$1 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r$1); var this$16 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); - var us$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$16, r$1); + var us$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$16, r$1); var hook2 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us$1, rr$1, ct$1); var props$1 = props.a; - var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$1, hook1, hook2); + var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, hook1, hook2); var hook3_raw = $i_react.useState((hook3_ctx$2 => () => { var $$x4 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); var $$x3 = hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; @@ -67,37 +62,31 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$() { })(hook3_ctx)); var this$23 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); var r$2 = this$23.by_$eq$eq__F2(); - var ct$2 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); - var rr$2 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r$2); + var ct$2 = $j_scala$002ereflect$002eManifestFactory$0024IntManifest$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var rr$2 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r$2); var this$28 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); - var us$2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024$0024anon$00242.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$28, r$2); + var us$2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$28, r$2); var hook3 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us$2, rr$2, ct$2); - props.a | 0; - var this$30 = hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - var $$x6 = this$30.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; - var this$31 = hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - var $$x5 = this$31.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; - var this$32 = hook3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - var sum = (($$x6 | 0) + ($$x5 | 0) | 0) + (this$32.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; - var this$40 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); - $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); - $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); - var self = "button"; - var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("DEBUG = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((hook1$3 => () => hook1$3.modState__F1__Ljapgolly_scalajs_react_Reusable(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$2 => { - var _$2$1 = _$2 | 0; - - return 1 + _$2$1 | 0; - })))(hook1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().reusableDefaultSync__F1())])); - var this$41 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$40, self, xs); - return this$41.rawElement__Ljapgolly_scalajs_react_facade_React$Element(); + var props$3 = props.a; + var hook4_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P3.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P3(props$3, hook1, hook2, hook3); + var this$31 = hook4_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; + var this$32 = this$31.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var $$x6 = this$32.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; + var this$33 = hook4_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; + var this$34 = this$33.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var $$x5 = this$34.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; + var this$35 = hook4_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P3__f_hook3; + var this$36 = this$35.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var sum = (($$x6 | 0) + ($$x5 | 0) | 0) + (this$36.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; + return ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; }; _s(rawComponent, "+059i36eGzSqNFL1PwYIRLAIpQ4="); var $$x7 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); - var this$42 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var this$39 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); - this.Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$__f_Component = $$x7.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$42.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); + this.Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$__f_Component = $$x7.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$39.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); } export { $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$ }; diff --git a/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksRRTest.scala b/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksRRTest.scala index c2b0c862d..ca2f45e13 100644 --- a/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksRRTest.scala +++ b/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksRRTest.scala @@ -908,12 +908,17 @@ object HooksRRTest extends TestSuite { .useState(100) .useStateBy((p, s1) => p.pi + s1.value) .useStateBy($ => $.props.pi + $.hook1.value + $.hook2.value) - .renderRR((p, s1, s2, s3) => + .renderRR { $ => + val p = $.props + val s1 = $.hook1 + val s2 = $.hook2 + val s3 = $.hook3 <.div( <.div(s"P=$p, s1=${s1.value}, s2=${s2.value}, s3=${s3.value}"), <.button(^.onClick --> ( s1.modState(_ + 1) >> s2.modState(-_) >> s3.modState(_ * 10) - )))) + ))) + } test(comp(PI(666))) { t => t.assertText("P=PI(666), s1=100, s2=766, s3=1532") diff --git a/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksTest.scala b/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksTest.scala index 6c0e7c632..72fb288c4 100644 --- a/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksTest.scala +++ b/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksTest.scala @@ -906,12 +906,17 @@ object HooksTest extends TestSuite { .useState(100) .useStateBy((p, s1) => p.pi + s1.value) .useStateBy($ => $.props.pi + $.hook1.value + $.hook2.value) - .render((p, s1, s2, s3) => + .render { $ => + val p = $.props + val s1 = $.hook1 + val s2 = $.hook2 + val s3 = $.hook3 <.div( <.div(s"P=$p, s1=${s1.value}, s2=${s2.value}, s3=${s3.value}"), <.button(^.onClick --> ( s1.modState(_ + 1) >> s2.modState(-_) >> s3.modState(_ * 10) - )))) + ))) + } test(comp(PI(666))) { t => t.assertText("P=PI(666), s1=100, s2=766, s3=1532") From 70cde24d4bbdad20a8dd96a2196e1e71e1d85193 Mon Sep 17 00:00:00 2001 From: David Barri Date: Fri, 17 Jun 2022 11:52:01 +1000 Subject: [PATCH 51/72] Refactor for readability --- .../scalajs/react/hooks/HookMacros.scala | 10 +++--- .../scalajs/react/hooks/HookMacros.scala | 34 +++++++++---------- .../react/hooks/AbstractHookMacros.scala | 1 - 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala index 7003a4165..a0738ea85 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -174,7 +174,7 @@ class HookMacros(val c: Context) extends MacroUtils { // =================================================================================================================== def _render[P, C <: Children] - (f: c.Tree, stepOption: Option[c.Tree], s: c.Tree, debug: Boolean) + (renderFn: c.Tree, stepOption: Option[c.Tree], summoner: c.Tree, debug: Boolean) (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = { val hookMacros = new HookMacrosImpl @@ -201,7 +201,7 @@ class HookMacros(val c: Context) extends MacroUtils { val newBody = rewriter(ctx) c.untypecheck(q""" val rawComponent: $JsFn.RawComponent[${Box(P)}] = props => $newBody - $ScalaFn.fromBoxed($JsFn.fromJsFn[${Box(P)}, $C](rawComponent)($s)) + $ScalaFn.fromBoxed($JsFn.fromJsFn[${Box(P)}, $C](rawComponent)($summoner)) """) case Left(err) => @@ -215,11 +215,11 @@ class HookMacros(val c: Context) extends MacroUtils { stepOption match { case Some(step) => q""" - val f = $step.squash($f) - $self.render(f)($s) + val f = $step.squash($renderFn) + $self.render(f)($summoner) """ case None => - q"$self.render($f)($s)" + q"$self.render($renderFn)($summoner)" } } diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala index a89310990..510038329 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala @@ -252,10 +252,10 @@ object HookMacros { import AbstractHookMacros.HookStep def _render1[P, C <: Children, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]] - (proxy: Expr[PrimaryProxy[P, C, Ctx, Step]], - f : Expr[Ctx => VdomNode], - s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], - debug: Boolean, + (proxy : Expr[PrimaryProxy[P, C, Ctx, Step]], + renderFn: Expr[Ctx => VdomNode], + summoner: Expr[CtorType.Summoner.Aux[Box[P], C, CT]], + debug : Boolean, )(using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], Step: Type[Step]): Expr[Component[P, CT]] = { import quotes.reflect.* @@ -264,19 +264,19 @@ object HookMacros { _render[P, C, CT]( macroApplication = self.asTerm, - s = s, + summoner = summoner, debug = debug, - renderStep = HookStep("renderRR", Nil, List(List(f.asTerm), List(s.asTerm))), - giveUp = () => '{ $self.render($f)($s) }, + renderStep = HookStep("renderRR", Nil, List(List(renderFn.asTerm), List(summoner.asTerm))), + giveUp = () => '{ $self.render($renderFn)($summoner) }, ) } def _render2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]] - (proxy: Expr[SecondaryProxy[P, C, Ctx, CtxFn, Step]], - f : Expr[CtxFn[VdomNode]], - step : Expr[Step], - s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], - debug: Boolean, + (proxy : Expr[SecondaryProxy[P, C, Ctx, CtxFn, Step]], + renderFn: Expr[CtxFn[VdomNode]], + step : Expr[Step], + summoner: Expr[CtorType.Summoner.Aux[Box[P], C, CT]], + debug : Boolean, )(using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], CtxFn: Type[CtxFn], Step: Type[Step]): Expr[Component[P, CT]] = { import quotes.reflect.* @@ -285,10 +285,10 @@ object HookMacros { _render[P, C, CT]( macroApplication = self.asTerm, - s = s, + summoner = summoner, debug = debug, - renderStep = HookStep("renderRR", Nil, List(List(f.asTerm), List(step.asTerm, s.asTerm))), - giveUp = () => '{ $self.render($step.squash($f)(_))($s) }, + renderStep = HookStep("renderRR", Nil, List(List(renderFn.asTerm), List(step.asTerm, summoner.asTerm))), + giveUp = () => '{ $self.render($step.squash($renderFn)(_))($summoner) }, ) } @@ -297,7 +297,7 @@ object HookMacros { private def _render[P, C <: Children, CT[-p, +u] <: CtorType[p, u]] (using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT]) (macroApplication: q.reflect.Term, - s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], + summoner : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], debug : Boolean, renderStep : HookStep[q.reflect.Term, q.reflect.TypeTree], giveUp : () => Expr[Component[P, CT]], @@ -336,7 +336,7 @@ object HookMacros { '{ val rawComponent: JsFn.RawComponent[Box[P]] = props => ${newBody('props)} - ScalaFn.fromBoxed(JsFn.fromJsFn[Box[P], C](rawComponent)($s)) + ScalaFn.fromBoxed(JsFn.fromJsFn[Box[P], C](rawComponent)($summoner)) } case Left(err) => diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala index 250cd6704..01eade5a4 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala @@ -18,7 +18,6 @@ object AbstractHookMacros { def sig = (targs, args) } - // =================================================================================================================== // Hook Rewriter From d0e4ea6e144054321a1733ba733b9982630d0318 Mon Sep 17 00:00:00 2001 From: David Barri Date: Fri, 17 Jun 2022 14:03:59 +1000 Subject: [PATCH 52/72] Support and test, all variations of hook component creation with RR --- library/TODO.md | 5 - .../scalajs/react/hooks/HookMacros.scala | 116 +++++---- .../react/hooks/HookMacrosTraits.scala | 16 +- .../scalajs/react/hooks/HookMacros.scala | 226 +++++++++++------- .../react/hooks/HookMacrosTraits.scala | 18 ++ .../react/hooks/AbstractHookMacros.scala | 28 +++ .../react/hooks/HookComponentBuilder.scala | 2 +- ...ren.scala => HooksWithChildrenCtxFn.scala} | 2 +- .../emissions/HooksWithChildrenCtxObj.scala | 15 ++ .../JustPropsChildrenViaHookApi.scala | 14 ++ .../test/emissions/JustPropsViaHookApi.scala | 13 + .../scalajs/react/test/emissions/Main.scala | 17 +- ...out2.js => HooksWithChildrenCtxFn-out2.js} | 58 ++--- ...out3.js => HooksWithChildrenCtxFn-out3.js} | 44 ++-- .../rr-sjr/HooksWithChildrenCtxObj-out2.js | 77 ++++++ .../rr-sjr/HooksWithChildrenCtxObj-out3.js | 74 ++++++ .../JustPropsChildrenViaHookApi-out2.js | 61 +++++ .../JustPropsChildrenViaHookApi-out3.js | 57 +++++ .../rr-sjr/JustPropsViaHookApi-out2.js | 59 +++++ .../rr-sjr/JustPropsViaHookApi-out3.js | 54 +++++ .../test/emissions/ReactRefreshTest.scala | 30 ++- .../react/test/emissions/util/Babel.scala | 23 +- .../scalajs/react/core/HooksRRTest.scala | 53 ++++ .../scalajs/react/core/HooksTest.scala | 53 ++++ 24 files changed, 895 insertions(+), 220 deletions(-) rename library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/{HooksWithChildren.scala => HooksWithChildrenCtxFn.scala} (92%) create mode 100644 library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksWithChildrenCtxObj.scala create mode 100644 library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/JustPropsChildrenViaHookApi.scala create mode 100644 library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/JustPropsViaHookApi.scala rename library/testEmissions/jvm/src/test/resources/rr-sjr/{HooksWithChildren-out2.js => HooksWithChildrenCtxFn-out2.js} (74%) rename library/testEmissions/jvm/src/test/resources/rr-sjr/{HooksWithChildren-out3.js => HooksWithChildrenCtxFn-out3.js} (81%) create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxObj-out2.js create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxObj-out3.js create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/JustPropsChildrenViaHookApi-out2.js create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/JustPropsChildrenViaHookApi-out3.js create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/JustPropsViaHookApi-out2.js create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/JustPropsViaHookApi-out3.js diff --git a/library/TODO.md b/library/TODO.md index d08c7081b..8f0475b73 100644 --- a/library/TODO.md +++ b/library/TODO.md @@ -1,9 +1,4 @@ ```scala -// HookComponentBuilder.scala -/* [23] */ def withPropsChildren: ComponentPC.First[P] -/* [--] */ def render(f: (P, PropsChildren) => VdomNode)(implicit s: CtorType.Summoner[Box[P], Children.Varargs]): Component[P, s.CT] -/* [--] */ def render in primary API - // Api.scala /* [--] */ def localLazyVal [A](a: => A)(implicit step: Step): step.Next[() => A] /* [--] */ def localLazyValBy [A](f: Ctx => A)(implicit step: Step): step.Next[() => A] diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala index a0738ea85..73847b2d4 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -1,42 +1,45 @@ package japgolly.scalajs.react.hooks import japgolly.microlibs.compiletime.MacroUtils +import japgolly.scalajs.react.Children import japgolly.scalajs.react.hooks.Api._ import japgolly.scalajs.react.internal.Box -import japgolly.scalajs.react.Children import scala.reflect.macros.blackbox.Context class HookMacros(val c: Context) extends MacroUtils { import c.universe._ - def render1[P, C <: Children] - (f: c.Tree)(s: c.Tree) - (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = + // ------------------------------------------------------------------------------------------------------------------- + + def render1[P, C <: Children](f: c.Tree)(s: c.Tree)(implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = _render1(f, s, false)(P, C) - def renderDebug1[P, C <: Children] - (f: c.Tree)(s: c.Tree) - (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = + def renderDebug1[P, C <: Children](f: c.Tree)(s: c.Tree)(implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = _render1(f, s, true)(P, C) - private def _render1[P, C <: Children] - (f: c.Tree, s: c.Tree, debug: Boolean) - (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = + private def _render1[P, C <: Children](f: c.Tree, s: c.Tree, debug: Boolean)(implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = _render[P, C](f, None, s, debug) - def render2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] - (f: c.Tree)(step: c.Tree, s: c.Tree) - (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = + // ------------------------------------------------------------------------------------------------------------------- + + def renderC1[P](f: c.Tree)(s: c.Tree)(implicit P: c.WeakTypeTag[P]): c.Tree = + _renderC1(f, s, false)(P) + + def renderDebugC1[P](f: c.Tree)(s: c.Tree)(implicit P: c.WeakTypeTag[P]): c.Tree = + _renderC1(f, s, true)(P) + + private def _renderC1[P](renderFn: c.Tree, summoner: c.Tree, debug: Boolean)(implicit P: c.WeakTypeTag[P]): c.Tree = + _render[P, Children.Varargs](renderFn, None, summoner, debug) + + // ------------------------------------------------------------------------------------------------------------------- + + def render2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]](f: c.Tree)(step: c.Tree, s: c.Tree)(implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = _render2(f, step, s, false)(P, C) - def renderDebug2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] - (f: c.Tree)(step: c.Tree, s: c.Tree) - (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = + def renderDebug2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]](f: c.Tree)(step: c.Tree, s: c.Tree)(implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = _render2(f, step, s, true)(P, C) - private def _render2[P, C <: Children] - (f: c.Tree, step: c.Tree, s: c.Tree, debug: Boolean) - (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = + private def _render2[P, C <: Children](f: c.Tree, step: c.Tree, s: c.Tree, debug: Boolean)(implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = _render[P, C](f, Some(step), s, debug) // =================================================================================================================== @@ -183,6 +186,26 @@ class HookMacros(val c: Context) extends MacroUtils { log.enabled = debug log.header() + def giveUp: Tree = { + val self = c.prefix + stepOption match { + case Some(step) => + q""" + val f = $step.squash($renderFn) + $self.render(f)($summoner) + """ + case None => + q"$self.render($renderFn)($summoner)" + } + } + + def onFailure(msg: String): Tree = { + import Console._ + log(RED_B + WHITE + "Giving up. " + msg + RESET) + c.warning(c.enclosingPosition, msg) + giveUp + } + val rewriteAttempt = for { hookDefn <- hookMacros.parse(c.macroApplication) @@ -190,38 +213,29 @@ class HookMacros(val c: Context) extends MacroUtils { } yield rewriter val result: Tree = - rewriteAttempt match { - - case Right(rewriter) => - val ctx = hookMacros.rewriterCtx( - props = q"props.unbox", - initChildren = q"val children = $PropsChildren.fromRawProps(props)", - children = q"children", - ) - val newBody = rewriter(ctx) - c.untypecheck(q""" - val rawComponent: $JsFn.RawComponent[${Box(P)}] = props => $newBody - $ScalaFn.fromBoxed($JsFn.fromJsFn[${Box(P)}, $C](rawComponent)($summoner)) - """) - - case Left(err) => - val msg = err() - import Console._ - log(RED_B + WHITE + "Giving up. " + msg + RESET) - c.warning(c.enclosingPosition, msg) - - val self = c.prefix - - stepOption match { - case Some(step) => - q""" - val f = $step.squash($renderFn) - $self.render(f)($summoner) - """ - case None => - q"$self.render($renderFn)($summoner)" - } - } + try + rewriteAttempt match { + + case Right(rewriter) => + val ctx = hookMacros.rewriterCtx( + props = q"props.unbox", + initChildren = q"val children = $PropsChildren.fromRawProps(props)", + children = q"children", + ) + val newBody = rewriter(ctx) + c.untypecheck(q""" + val rawComponent: $JsFn.RawComponent[${Box(P)}] = props => $newBody + $ScalaFn.fromBoxed($JsFn.fromJsFn[${Box(P)}, $C](rawComponent)($summoner)) + """) + + case Left(err) => + onFailure(err()) + } + catch { + case err: Throwable => + err.printStackTrace() + onFailure(err.getMessage()) + } log.footer(showCode(result)) result diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacrosTraits.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacrosTraits.scala index f9f5aa93f..cf8a1301a 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacrosTraits.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacrosTraits.scala @@ -4,7 +4,7 @@ import japgolly.scalajs.react.component.ScalaFn.Component import japgolly.scalajs.react.hooks.Api._ import japgolly.scalajs.react.internal.Box import japgolly.scalajs.react.vdom.VdomNode -import japgolly.scalajs.react.{Children, CtorType} +import japgolly.scalajs.react.{Children, CtorType, PropsChildren} trait ApiPrimaryWithRenderMacros[P, C <: Children, Ctx, Step <: AbstractStep] { self: PrimaryWithRender[P, C, Ctx, Step] => @@ -16,6 +16,20 @@ trait ApiPrimaryWithRenderMacros[P, C <: Children, Ctx, Step <: AbstractStep] { macro HookMacros.renderDebug1[P, C] } +// ===================================================================================================================== + +trait ComponentPCMacros[P] { + self: HookComponentBuilder.ComponentPC.First[P] => + + final def renderRR(f: (P, PropsChildren) => VdomNode)(implicit s: CtorType.Summoner[Box[P], Children.Varargs]): Component[P, s.CT] = + macro HookMacros.renderC1[P] + + final def renderRRDebug(f: (P, PropsChildren) => VdomNode)(implicit s: CtorType.Summoner[Box[P], Children.Varargs]): Component[P, s.CT] = + macro HookMacros.renderDebugC1[P] +} + +// ===================================================================================================================== + trait ApiSecondaryWithRenderMacros[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] { self: PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step] => diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala index 510038329..07e01051a 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala @@ -18,6 +18,8 @@ import scala.scalajs.js object HookMacros { + // ------------------------------------------------------------------------------------------------------------------- + type PrimaryProxy[P, C <: Children, Ctx, Step <: AbstractStep] = ApiPrimaryWithRenderMacros[P, C, Ctx, Step] @@ -25,37 +27,62 @@ object HookMacros { PrimaryWithRender[P, C, Ctx, Step] // https://github.com/lampepfl/dotty/issues/15357 - inline def render1Workaround[ - P, C <: Children, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u] - ](inline proxy: PrimaryProxy[P, C, Ctx, Step], - inline f : Ctx => VdomNode, - inline s : CtorType.Summoner.Aux[Box[P], C, CT], - ): Component[P, CT] = + inline def render1Workaround[P, C <: Children, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]]( + inline proxy: PrimaryProxy[P, C, Ctx, Step], + inline f : Ctx => VdomNode, + inline s : CtorType.Summoner.Aux[Box[P], C, CT]): Component[P, CT] = ${ render1[P, C, Ctx, Step, CT]('proxy, 'f, 's) } - inline def renderDebug1Workaround[ - P, C <: Children, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u] - ](inline proxy: PrimaryProxy[P, C, Ctx, Step], - inline f : Ctx => VdomNode, - inline s : CtorType.Summoner.Aux[Box[P], C, CT], - ): Component[P, CT] = + inline def renderDebug1Workaround[P, C <: Children, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]]( + inline proxy: PrimaryProxy[P, C, Ctx, Step], + inline f : Ctx => VdomNode, + inline s : CtorType.Summoner.Aux[Box[P], C, CT]): Component[P, CT] = ${ renderDebug1[P, C, Ctx, Step, CT]('proxy, 'f, 's) } - def render1[P, C <: Children, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]] - (proxy: Expr[PrimaryProxy[P, C, Ctx, Step]], + def render1[P, C <: Children, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]]( + proxy: Expr[PrimaryProxy[P, C, Ctx, Step]], f : Expr[Ctx => VdomNode], - s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], - )(using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], Step: Type[Step]): Expr[Component[P, CT]] = + s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]]) + (using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], Step: Type[Step]): Expr[Component[P, CT]] = _render1(proxy, f, s, false) - def renderDebug1[P, C <: Children, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]] - (proxy: Expr[PrimaryProxy[P, C, Ctx, Step]], + def renderDebug1[P, C <: Children, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]]( + proxy: Expr[PrimaryProxy[P, C, Ctx, Step]], f : Expr[Ctx => VdomNode], - s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], - )(using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], Step: Type[Step]): Expr[Component[P, CT]] = + s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]]) + (using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], Step: Type[Step]): Expr[Component[P, CT]] = _render1(proxy, f, s, true) - // =================================================================================================================== + // ------------------------------------------------------------------------------------------------------------------- + + // https://github.com/lampepfl/dotty/issues/15357 + inline def renderC1Workaround[P, CT[-p, +u] <: CtorType[p, u]]( + inline proxy: ComponentPCMacros[P], + inline f : (P, PropsChildren) => VdomNode, + inline s : CtorType.Summoner.Aux[Box[P], Children.Varargs, CT]): Component[P, CT] = + ${ renderC1[P, CT]('proxy, 'f, 's) } + + inline def renderDebugC1Workaround[P, CT[-p, +u] <: CtorType[p, u]]( + inline proxy: ComponentPCMacros[P], + inline f : (P, PropsChildren) => VdomNode, + inline s : CtorType.Summoner.Aux[Box[P], Children.Varargs, CT]): Component[P, CT] = + ${ renderDebugC1[P, CT]('proxy, 'f, 's) } + + def renderC1[P, CT[-p, +u] <: CtorType[p, u]]( + proxy: Expr[ComponentPCMacros[P]], + f : Expr[(P, PropsChildren) => VdomNode], + s : Expr[CtorType.Summoner.Aux[Box[P], Children.Varargs, CT]]) + (using q: Quotes, P: Type[P], CT: Type[CT]): Expr[Component[P, CT]] = + _renderC1(proxy, f, s, false) + + def renderDebugC1[P, CT[-p, +u] <: CtorType[p, u]]( + proxy: Expr[ComponentPCMacros[P]], + f : Expr[(P, PropsChildren) => VdomNode], + s : Expr[CtorType.Summoner.Aux[Box[P], Children.Varargs, CT]]) + (using q: Quotes, P: Type[P], CT: Type[CT]): Expr[Component[P, CT]] = + _renderC1(proxy, f, s, true) + + // ------------------------------------------------------------------------------------------------------------------- type SecondaryProxy[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] = ApiSecondaryWithRenderMacros[P, C, Ctx, CtxFn, Step] @@ -64,38 +91,34 @@ object HookMacros { PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step] // https://github.com/lampepfl/dotty/issues/15357 - inline def render2Workaround[ - P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u] - ](inline proxy: SecondaryProxy[P, C, Ctx, CtxFn, Step], - inline f : CtxFn[VdomNode], - inline step : Step, - inline s : CtorType.Summoner.Aux[Box[P], C, CT], - ): Component[P, CT] = + inline def render2Workaround[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]]( + inline proxy: SecondaryProxy[P, C, Ctx, CtxFn, Step], + inline f : CtxFn[VdomNode], + inline step : Step, + inline s : CtorType.Summoner.Aux[Box[P], C, CT]): Component[P, CT] = ${ render2[P, C, Ctx, CtxFn, Step, CT]('proxy, 'f, 'step, 's) } - inline def renderDebug2Workaround[ - P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u] - ](inline proxy: SecondaryProxy[P, C, Ctx, CtxFn, Step], - inline f : CtxFn[VdomNode], - inline step : Step, - inline s : CtorType.Summoner.Aux[Box[P], C, CT], - ): Component[P, CT] = + inline def renderDebug2Workaround[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]]( + inline proxy: SecondaryProxy[P, C, Ctx, CtxFn, Step], + inline f : CtxFn[VdomNode], + inline step : Step, + inline s : CtorType.Summoner.Aux[Box[P], C, CT]): Component[P, CT] = ${ renderDebug2[P, C, Ctx, CtxFn, Step, CT]('proxy, 'f, 'step, 's) } - def render2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]] - (proxy: Expr[SecondaryProxy[P, C, Ctx, CtxFn, Step]], + def render2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]]( + proxy: Expr[SecondaryProxy[P, C, Ctx, CtxFn, Step]], f : Expr[CtxFn[VdomNode]], step : Expr[Step], - s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], - )(using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], CtxFn: Type[CtxFn], Step: Type[Step]): Expr[Component[P, CT]] = + s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]]) + (using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], CtxFn: Type[CtxFn], Step: Type[Step]): Expr[Component[P, CT]] = _render2(proxy, f, step, s, false) - def renderDebug2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]] - (proxy: Expr[SecondaryProxy[P, C, Ctx, CtxFn, Step]], + def renderDebug2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]]( + proxy: Expr[SecondaryProxy[P, C, Ctx, CtxFn, Step]], f : Expr[CtxFn[VdomNode]], step : Expr[Step], - s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], - )(using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], CtxFn: Type[CtxFn], Step: Type[Step]): Expr[Component[P, CT]] = + s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]]) + (using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], CtxFn: Type[CtxFn], Step: Type[Step]): Expr[Component[P, CT]] = _render2(proxy, f, step, s, true) // =================================================================================================================== @@ -166,7 +189,14 @@ object HookMacros { override protected val rewriterBridge: RewriterBridge = HookRewriter.Bridge[Stmt, Term, Ref]( apply = Apply(_, _), - hookCtx = (c, as) => Select.overloaded((if (c) '{HookCtx.withChildren} else '{HookCtx}).asTerm, "apply", as.map(_.tpe), as), + hookCtx = (usesChildren, args) => { + if (usesChildren) { + // .patch below removes the PropsChildren arg + val targs = args.patch(1, Nil, 1).map(_.tpe) + Select.overloaded('{HookCtx.withChildren}.asTerm, "apply", targs, args) + } else + Select.overloaded('{HookCtx}.asTerm, "apply", args.map(_.tpe), args) + }, refToTerm = _.ref, valDef = (n, t) => { val r = untypedValDef(n, t.tpe, Flags.EmptyFlags)(t); (r.valDef, r) }, ) @@ -251,12 +281,12 @@ object HookMacros { import AbstractHookMacros.HookStep - def _render1[P, C <: Children, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]] - (proxy : Expr[PrimaryProxy[P, C, Ctx, Step]], + def _render1[P, C <: Children, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]]( + proxy : Expr[PrimaryProxy[P, C, Ctx, Step]], renderFn: Expr[Ctx => VdomNode], summoner: Expr[CtorType.Summoner.Aux[Box[P], C, CT]], - debug : Boolean, - )(using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], Step: Type[Step]): Expr[Component[P, CT]] = { + debug : Boolean) + (using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], Step: Type[Step]): Expr[Component[P, CT]] = { import quotes.reflect.* @@ -271,13 +301,33 @@ object HookMacros { ) } - def _render2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]] - (proxy : Expr[SecondaryProxy[P, C, Ctx, CtxFn, Step]], + def _renderC1[P, CT[-p, +u] <: CtorType[p, u]]( + proxy : Expr[ComponentPCMacros[P]], + renderFn: Expr[(P, PropsChildren) => VdomNode], + summoner: Expr[CtorType.Summoner.Aux[Box[P], Children.Varargs, CT]], + debug : Boolean) + (using q: Quotes, P: Type[P], CT: Type[CT]): Expr[Component[P, CT]] = { + + import quotes.reflect.* + + val self = proxy.asInstanceOf[Expr[HookComponentBuilder.ComponentPC.First[P]]] + + _render[P, Children.Varargs, CT]( + macroApplication = self.asTerm, + summoner = summoner, + debug = debug, + renderStep = HookStep("renderRR", Nil, List(List(renderFn.asTerm), List(summoner.asTerm))), + giveUp = () => '{ $self.render($renderFn)($summoner) }, + ) + } + + def _render2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]]( + proxy : Expr[SecondaryProxy[P, C, Ctx, CtxFn, Step]], renderFn: Expr[CtxFn[VdomNode]], step : Expr[Step], summoner: Expr[CtorType.Summoner.Aux[Box[P], C, CT]], - debug : Boolean, - )(using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], CtxFn: Type[CtxFn], Step: Type[Step]): Expr[Component[P, CT]] = { + debug : Boolean) + (using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], CtxFn: Type[CtxFn], Step: Type[Step]): Expr[Component[P, CT]] = { import quotes.reflect.* @@ -294,14 +344,13 @@ object HookMacros { // =================================================================================================================== - private def _render[P, C <: Children, CT[-p, +u] <: CtorType[p, u]] - (using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT]) - (macroApplication: q.reflect.Term, + private def _render[P, C <: Children, CT[-p, +u] <: CtorType[p, u]]( + using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT])( + macroApplication: q.reflect.Term, summoner : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], debug : Boolean, renderStep : HookStep[q.reflect.Term, q.reflect.TypeTree], - giveUp : () => Expr[Component[P, CT]], - ): Expr[Component[P, CT]] = { + giveUp : () => Expr[Component[P, CT]]): Expr[Component[P, CT]] = { import quotes.reflect.* @@ -312,6 +361,13 @@ object HookMacros { log.header() // log("self", macroApplication.show) + def onFailure(msg: String): Expr[Component[P, CT]] = { + import Console._ + log(RED_B + WHITE + "Giving up. " + msg + RESET) + report.warning(msg) + giveUp() + } + val rewriteAttempt = for { hookDefn <- hookMacros.parse(macroApplication) @@ -319,34 +375,34 @@ object HookMacros { } yield rewriter val result: Expr[Component[P, CT]] = - rewriteAttempt match { - - case Right(rewriter) => - type JsProps = Box[P] with facade.PropsWithChildren - - def newBody(props: Expr[JsProps]): Expr[React.Node] = { - val children = typedValDef[PropsChildren]("children", Flags.EmptyFlags)('{ PropsChildren.fromRawProps($props) }) - val ctx = hookMacros.rewriterCtx( - props = '{ $props.unbox }.asTerm, - initChildren = children.valDef, - children = children.ref.asTerm, - ) - rewriter(ctx) - } - - '{ - val rawComponent: JsFn.RawComponent[Box[P]] = props => ${newBody('props)} - ScalaFn.fromBoxed(JsFn.fromJsFn[Box[P], C](rawComponent)($summoner)) - } - - case Left(err) => - val msg = err() - import Console._ - log(RED_B + WHITE + "Giving up. " + msg + RESET) - - report.warning(msg) - - giveUp() + try + rewriteAttempt match { + + case Right(rewriter) => + type JsProps = Box[P] with facade.PropsWithChildren + + def newBody(props: Expr[JsProps]): Expr[React.Node] = { + val children = typedValDef[PropsChildren]("children", Flags.EmptyFlags)('{ PropsChildren.fromRawProps($props) }) + val ctx = hookMacros.rewriterCtx( + props = '{ $props.unbox }.asTerm, + initChildren = children.valDef, + children = children.ref.asTerm, + ) + rewriter(ctx) + } + + '{ + val rawComponent: JsFn.RawComponent[Box[P]] = props => ${newBody('props)} + ScalaFn.fromBoxed(JsFn.fromJsFn[Box[P], C](rawComponent)($summoner)) + } + + case Left(err) => + onFailure(err()) + } + catch { + case err: Throwable => + // err.printStackTrace() + onFailure(err.getMessage()) } log.footer(result.show) diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala index 6efa8531a..4537f1892 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala @@ -32,6 +32,24 @@ object ApiPrimaryWithRenderMacros { // ===================================================================================================================== +trait ComponentPCMacros[P] + extends ApiPrimaryWithRenderMacros[P, Children.Varargs, HookCtx.PC0[P], HookComponentBuilder.ComponentPC.FirstStep[P]] { + self: HookComponentBuilder.ComponentPC.First[P] => +} + +object ComponentPCMacros { + extension [P](inline self: ComponentPCMacros[P]) { + + inline def renderRR(inline f: (P, PropsChildren) => VdomNode)(implicit inline s: CtorType.Summoner[Box[P], Children.Varargs]): Component[P, s.CT] = + HookMacros.renderC1Workaround[P, s.CT](self, f, s) + + inline def renderRRDebug(inline f: (P, PropsChildren) => VdomNode)(implicit inline s: CtorType.Summoner[Box[P], Children.Varargs]): Component[P, s.CT] = + HookMacros.renderDebugC1Workaround[P, s.CT](self, f, s) + } +} + +// ===================================================================================================================== + trait ApiSecondaryWithRenderMacros[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] extends ApiPrimaryWithRenderMacros[P, C, Ctx, Step] { self: PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step] => diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala index 01eade5a4..c6d54710e 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala @@ -7,6 +7,34 @@ import japgolly.scalajs.react.vdom.VdomNode import scala.annotation.{nowarn, tailrec} import scala.reflect.ClassTag +/* Coverage + * ======== + * + * - P + * - behaviour tested in HooksRRTest.testProps() + * - react-refresh integration tested in JustPropsViaHookApi + * + * - CtxObj(P) + * - behaviour tested in HooksRRTest.testUseState() + * - react-refresh integration tested in UseStateWithReuse + * + * - CtxFn(P) + * - behaviour tested in HooksRRTest.testUseCallback() + * - react-refresh integration tested in UseState + * + * - (P, PC) + * - behaviour tested in HooksRRTest.testPropsChildren() + * - react-refresh integration tested in JustPropsChildrenViaHookApi + * + * - CtxObj(P, PC) + * - behaviour tested in HooksRRTest.testPropsChildrenCtxObj() + * - react-refresh integration tested in HooksWithChildrenCtxObj + * + * - CtxFn(P, PC) + * - behaviour tested in HooksRRTest.testPropsChildrenCtxFn() + * - react-refresh integration tested in HooksWithChildrenCtxFn + */ + object AbstractHookMacros { final case class HookDefn[Term, TypeTree](steps: Vector[HookStep[Term, TypeTree]]) { diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/HookComponentBuilder.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/HookComponentBuilder.scala index 5b35e50d1..76ef69bb4 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/HookComponentBuilder.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/HookComponentBuilder.scala @@ -107,7 +107,7 @@ object HookComponentBuilder { object ComponentPC { - final class First[P](init: HookCtx.PC0[P] => Unit) extends Api.PrimaryWithRender[P, Children.Varargs, HookCtx.PC0[P], FirstStep[P]] { + final class First[P](init: HookCtx.PC0[P] => Unit) extends Api.PrimaryWithRender[P, Children.Varargs, HookCtx.PC0[P], FirstStep[P]] with ComponentPCMacros[P] { type Ctx = HookCtx.PC0[P] override protected def self(f: Ctx => Any)(implicit step: Step): step.Self = diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksWithChildren.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksWithChildrenCtxFn.scala similarity index 92% rename from library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksWithChildren.scala rename to library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksWithChildrenCtxFn.scala index c3a36bb14..7bb0737ee 100644 --- a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksWithChildren.scala +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksWithChildrenCtxFn.scala @@ -3,7 +3,7 @@ package japgolly.scalajs.react.test.emissions import japgolly.scalajs.react._ import japgolly.scalajs.react.vdom.html_<^._ -object HooksWithChildren { +object HooksWithChildrenCtxFn { val Component = ScalaFnComponent.withHooks[Int] .withPropsChildren diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksWithChildrenCtxObj.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksWithChildrenCtxObj.scala new file mode 100644 index 000000000..eb86dc193 --- /dev/null +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksWithChildrenCtxObj.scala @@ -0,0 +1,15 @@ +package japgolly.scalajs.react.test.emissions + +import japgolly.scalajs.react._ +import japgolly.scalajs.react.vdom.html_<^._ + +object HooksWithChildrenCtxObj { + + val Component = ScalaFnComponent.withHooks[Int] + .withPropsChildren + .useState(123) + .renderRR { $ => + val sum = $.props + $.hook1.value + $.propsChildren.count + sum + } +} diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/JustPropsChildrenViaHookApi.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/JustPropsChildrenViaHookApi.scala new file mode 100644 index 000000000..51e132c8b --- /dev/null +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/JustPropsChildrenViaHookApi.scala @@ -0,0 +1,14 @@ +package japgolly.scalajs.react.test.emissions + +import japgolly.scalajs.react._ +import japgolly.scalajs.react.vdom.html_<^._ + +object JustPropsChildrenViaHookApi { + + val Component = ScalaFnComponent.withHooks[Int] + .withPropsChildren + .renderRR { (p, c) => + val sum = p + c.count + sum + } +} diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/JustPropsViaHookApi.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/JustPropsViaHookApi.scala new file mode 100644 index 000000000..98b41cd24 --- /dev/null +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/JustPropsViaHookApi.scala @@ -0,0 +1,13 @@ +package japgolly.scalajs.react.test.emissions + +import japgolly.scalajs.react._ +import japgolly.scalajs.react.vdom.html_<^._ + +object JustPropsViaHookApi { + + val Component = ScalaFnComponent.withHooks[Int] + .renderRR { p => + val magicNumber = p + 654 + magicNumber + } +} diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala index 5722863bd..cc4d553d7 100644 --- a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala @@ -14,13 +14,16 @@ object Main { private val Component = ScalaFnComponent[Unit] { _ => <.div( - CustomHooks.Component(0), - CustomHooksBy.Component(0), - HooksWithChildren.Component(0)(<.div), - HooksWithJsFns.Component(0), - HooksWithScalaFns.Component(0), - UseState.Component(0), - UseStateWithReuse.Component(0), + CustomHooks .Component(0), + CustomHooksBy .Component(0), + HooksWithChildrenCtxFn .Component(0)(<.div), + HooksWithChildrenCtxObj .Component(0)(<.div), + HooksWithJsFns .Component(0), + HooksWithScalaFns .Component(0), + JustPropsChildrenViaHookApi.Component(0)(<.div), + JustPropsViaHookApi .Component(0), + UseState .Component(0), + UseStateWithReuse .Component(0), ) } } diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxFn-out2.js similarity index 74% rename from library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out2.js rename to library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxFn-out2.js index 33909bb80..5cef89e4f 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxFn-out2.js @@ -4,7 +4,7 @@ var _s = $RefreshSig$(); import * as $i_react from "react"; import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024 from "./japgolly.scalajs.react.PropsChildren$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ePropsChildren from "./japgolly.scalajs.react.PropsChildren.js"; import * as $j_japgolly$002escalajs$002ereact$002eReusable$0024 from "./japgolly.scalajs.react.Reusable$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; @@ -25,36 +25,36 @@ import * as $j_scala$002eFunction1 from "./scala.Function1.js"; import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; import * as $j_scala$002escalajs$002eruntime$002eWrappedVarArgs from "./scala.scalajs.runtime.WrappedVarArgs.js"; -function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$() { - this.Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$__f_Component = null; - $n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$ = this; +function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$() { + this.Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$__f_Component = null; + $n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$ = this; - var rawComponent = arg1$2 => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$().japgolly$scalajs$react$test$emissions$HooksWithChildren$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2); + var rawComponent = arg1$2 => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$().japgolly$scalajs$react$test$emissions$HooksWithChildrenCtxFn$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2); var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); var this$1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonPC__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$(), null)); - this.Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$1.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); + this.Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$1.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); } -export { $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$ }; -$c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$.prototype = new $j_java$002elang$002eObject.$h_O(); -$c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$; +export { $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$ }; +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$; -function $h_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$() {} +function $h_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$() {} -export { $h_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$ }; -$h_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$.prototype; -$c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$.prototype.japgolly$scalajs$react$test$emissions$HooksWithChildren$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s(function (props) { +export { $h_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$ }; +$h_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$.prototype; +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$.prototype.japgolly$scalajs$react$test$emissions$HooksWithChildrenCtxFn$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s(function (props) { _s(); - var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$().fromRawProps__sjs_js_Object__sjs_js_Any(props); + var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren.$m_Ljapgolly_scalajs_react_PropsChildren$().fromRawProps__sjs_js_Object__sjs_js_Any(props); var hook1_raw = $i_react.useState(() => { - $m_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$(); + $m_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$(); return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123); }); var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); - var sum = ((props.a | 0) + (hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$().count$extension__sjs_js_Any__I(children) | 0; + var sum = ((props.a | 0) + (hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + $j_japgolly$002escalajs$002ereact$002ePropsChildren.$m_Ljapgolly_scalajs_react_PropsChildren$().count$extension__sjs_js_Any__I(children) | 0; var $$x1 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); @@ -68,24 +68,24 @@ $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$.prototype.japgolly$ })(hook1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(children))]; var this$17 = $$x1.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("button", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); return $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement.$f_Ljapgolly_scalajs_react_vdom_VdomElement__rawNode__sjs_js_$bar(this$17); -}, "PgpFLcjq+HHAg1XBIX3s6h+EMrQ="); -var $d_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$ = new $j_java$002elang$002eObject.$TypeData().initClass({ - Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$: 0 -}, false, "japgolly.scalajs.react.test.emissions.HooksWithChildren$", { - Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$: 1, +}, "MF3NO47k/7zFY+ODeoUMhnxB6Fg="); +var $d_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$: 0 +}, false, "japgolly.scalajs.react.test.emissions.HooksWithChildrenCtxFn$", { + Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$: 1, O: 1 }); -export { $d_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$ }; -$c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$; -var $n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$; +export { $d_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$ }; +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$; +var $n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$; -function $m_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$() { - if (!$n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$) { - $n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$ = new $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$(); +function $m_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$) { + $n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$ = new $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$(); } ; - return $n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$; + return $n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$; } -export { $m_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$ }; +export { $m_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxFn-out3.js similarity index 81% rename from library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out3.js rename to library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxFn-out3.js index 7d45cb310..95d206a52 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildren-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxFn-out3.js @@ -23,11 +23,11 @@ import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; import * as $j_scala$002eFunction1 from "./scala.Function1.js"; import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; -function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$() { +function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$() { var _s = $RefreshSig$(); - this.Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$__f_Component = null; - $n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$ = this; + this.Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$__f_Component = null; + $n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$ = this; var rawComponent = props => { _s(); @@ -60,34 +60,34 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$() { var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); var this$17 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonPC__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); - this.Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$17.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); + this.Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$17.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); } -export { $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$ }; -$c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$.prototype = new $j_java$002elang$002eObject.$h_O(); -$c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$; +export { $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$ }; +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$; -function $h_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$() {} +function $h_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$() {} -export { $h_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$ }; -$h_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$.prototype; -var $d_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$ = new $j_java$002elang$002eObject.$TypeData().initClass({ - Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$: 0 -}, false, "japgolly.scalajs.react.test.emissions.HooksWithChildren$", { - Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$: 1, +export { $h_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$ }; +$h_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$.prototype; +var $d_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$: 0 +}, false, "japgolly.scalajs.react.test.emissions.HooksWithChildrenCtxFn$", { + Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$: 1, O: 1 }); -export { $d_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$ }; -$c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$; -var $n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$; +export { $d_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$ }; +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$; +var $n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$; -function $m_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$() { - if (!$n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$) { - $n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$ = new $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$(); +function $m_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$) { + $n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$ = new $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$(); } ; - return $n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$; + return $n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$; } -export { $m_Ljapgolly_scalajs_react_test_emissions_HooksWithChildren$ }; +export { $m_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxObj-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxObj-out2.js new file mode 100644 index 000000000..cbd016dbf --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxObj-out2.js @@ -0,0 +1,77 @@ +'use strict'; + +var _s = $RefreshSig$(); + +import * as $i_react from "react"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ePropsChildren from "./japgolly.scalajs.react.PropsChildren.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024PC1 from "./japgolly.scalajs.react.hooks.HookCtx$PC1.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF from "./japgolly.scalajs.react.hooks.Hooks$UseStateF.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 from "./japgolly.scalajs.react.internal.Singleton$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; + +function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$() { + this.Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$__f_Component = null; + $n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$ = this; + + var rawComponent = arg1$2 => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$().japgolly$scalajs$react$test$emissions$HooksWithChildrenCtxObj$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2); + + var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonPC__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$(), null)); + this.Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$1.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$ }; +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$; + +function $h_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$ }; +$h_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$.prototype; +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$.prototype.japgolly$scalajs$react$test$emissions$HooksWithChildrenCtxObj$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s(function (props) { + _s(); + + var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren.$m_Ljapgolly_scalajs_react_PropsChildren$().fromRawProps__sjs_js_Object__sjs_js_Any(props); + var hook1_raw = $i_react.useState(() => { + $m_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$(); + return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123); + }); + var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); + var props$1 = props.a; + var hook2_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024PC1.$c_Ljapgolly_scalajs_react_hooks_HookCtx$PC1(props$1, children, hook1); + var $$x1 = hook2_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + var this$3 = hook2_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$PC1__f_hook1; + var sum = (($$x1 | 0) + (this$3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + $j_japgolly$002escalajs$002ereact$002ePropsChildren.$m_Ljapgolly_scalajs_react_PropsChildren$().count$extension__sjs_js_Any__I(hook2_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$PC0__f_propsChildren) | 0; + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + return new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; +}, "cFmG9aM+zFKRZ0BlWulKs0faOP4="); +var $d_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$: 0 +}, false, "japgolly.scalajs.react.test.emissions.HooksWithChildrenCtxObj$", { + Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$ }; +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$; +var $n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$; + +function $m_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$) { + $n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$ = new $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxObj-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxObj-out3.js new file mode 100644 index 000000000..be38e5c63 --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxObj-out3.js @@ -0,0 +1,74 @@ +'use strict'; + +import * as $i_react from "react"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024package$0024PropsChildren$0024 from "./japgolly.scalajs.react.PropsChildren$package$PropsChildren$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024PC1 from "./japgolly.scalajs.react.hooks.HookCtx$PC1.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF from "./japgolly.scalajs.react.hooks.Hooks$UseStateF.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; + +function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$() { + var _s = $RefreshSig$(); + + this.Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$__f_Component = null; + $n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$ = this; + + var rawComponent = props => { + _s(); + + var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024package$0024PropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$package$PropsChildren$().fromRawProps__sjs_js_Object__O(props); + var hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); + var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); + var props$1 = props.a; + var hook2_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024PC1.$c_Ljapgolly_scalajs_react_hooks_HookCtx$PC1(props$1, children, hook1); + var $$x2 = hook2_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + var this$4 = hook2_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$PC1__f_hook1; + var $$x1 = this$4.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; + var self = hook2_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$PC0__f_propsChildren; + var sum = (($$x2 | 0) + ($$x1 | 0) | 0) + ($i_react.Children.count(self) | 0) | 0; + return ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; + }; + + _s(rawComponent, "+3ihSvpsaY0Wt3tAhbVZmTm3dGg="); + + var $$x3 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$8 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonPC__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); + this.Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$__f_Component = $$x3.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$8.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$ }; +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$; + +function $h_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$ }; +$h_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$.prototype; +var $d_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$: 0 +}, false, "japgolly.scalajs.react.test.emissions.HooksWithChildrenCtxObj$", { + Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$ }; +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$; +var $n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$; + +function $m_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$) { + $n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$ = new $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/JustPropsChildrenViaHookApi-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/JustPropsChildrenViaHookApi-out2.js new file mode 100644 index 000000000..a5e174b26 --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/JustPropsChildrenViaHookApi-out2.js @@ -0,0 +1,61 @@ +'use strict'; + +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ePropsChildren from "./japgolly.scalajs.react.PropsChildren.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 from "./japgolly.scalajs.react.internal.Singleton$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; + +function $c_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$() { + this.Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$__f_Component = null; + $n_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$ = this; + + var rawComponent = arg1$2 => $m_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$().japgolly$scalajs$react$test$emissions$JustPropsChildrenViaHookApi$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2); + + var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonPC__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$(), null)); + this.Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$1.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$ }; +$c_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$; + +function $h_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$ }; +$h_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$.prototype; + +$c_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$.prototype.japgolly$scalajs$react$test$emissions$JustPropsChildrenViaHookApi$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = function (props) { + var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren.$m_Ljapgolly_scalajs_react_PropsChildren$().fromRawProps__sjs_js_Object__sjs_js_Any(props); + var sum = (props.a | 0) + $j_japgolly$002escalajs$002ereact$002ePropsChildren.$m_Ljapgolly_scalajs_react_PropsChildren$().count$extension__sjs_js_Any__I(children) | 0; + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + return new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; +}; + +var $d_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$: 0 +}, false, "japgolly.scalajs.react.test.emissions.JustPropsChildrenViaHookApi$", { + Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$ }; +$c_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$; +var $n_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$; + +function $m_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$) { + $n_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$ = new $c_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/JustPropsChildrenViaHookApi-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/JustPropsChildrenViaHookApi-out3.js new file mode 100644 index 000000000..4bf4cd35e --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/JustPropsChildrenViaHookApi-out3.js @@ -0,0 +1,57 @@ +'use strict'; + +import * as $i_react from "react"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024package$0024PropsChildren$0024 from "./japgolly.scalajs.react.PropsChildren$package$PropsChildren$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; + +function $c_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$() { + this.Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$__f_Component = null; + $n_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$ = this; + + var rawComponent = props => { + var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024package$0024PropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$package$PropsChildren$().fromRawProps__sjs_js_Object__O(props); + var p = props.a | 0; + var sum = p + ($i_react.Children.count(children) | 0) | 0; + return ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; + }; + + var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$5 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonPC__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); + this.Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$5.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$ }; +$c_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$; + +function $h_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$ }; +$h_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$.prototype; +var $d_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$: 0 +}, false, "japgolly.scalajs.react.test.emissions.JustPropsChildrenViaHookApi$", { + Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$ }; +$c_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$; +var $n_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$; + +function $m_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$) { + $n_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$ = new $c_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/JustPropsViaHookApi-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/JustPropsViaHookApi-out2.js new file mode 100644 index 000000000..9c8e252bb --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/JustPropsViaHookApi-out2.js @@ -0,0 +1,59 @@ +'use strict'; + +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 from "./japgolly.scalajs.react.internal.Singleton$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; + +function $c_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$() { + this.Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$__f_Component = null; + $n_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$ = this; + + var rawComponent = arg1$2 => $m_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$().japgolly$scalajs$react$test$emissions$JustPropsViaHookApi$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2); + + var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$(), null)); + this.Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$1.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$ }; +$c_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$; + +function $h_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$ }; +$h_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$.prototype; + +$c_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$.prototype.japgolly$scalajs$react$test$emissions$JustPropsViaHookApi$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = function (props) { + var magicNumber = 654 + (props.a | 0) | 0; + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + return new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(magicNumber).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; +}; + +var $d_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$: 0 +}, false, "japgolly.scalajs.react.test.emissions.JustPropsViaHookApi$", { + Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$ }; +$c_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$; +var $n_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$; + +function $m_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$) { + $n_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$ = new $c_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/JustPropsViaHookApi-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/JustPropsViaHookApi-out3.js new file mode 100644 index 000000000..934e8636e --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/JustPropsViaHookApi-out3.js @@ -0,0 +1,54 @@ +'use strict'; + +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; + +function $c_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$() { + this.Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$__f_Component = null; + $n_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$ = this; + + var rawComponent = props => { + var p = props.a | 0; + var magicNumber = 654 + p | 0; + return ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(magicNumber)).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; + }; + + var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$4 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); + this.Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$4.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$ }; +$c_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$; + +function $h_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$ }; +$h_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$.prototype; +var $d_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$: 0 +}, false, "japgolly.scalajs.react.test.emissions.JustPropsViaHookApi$", { + Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$ }; +$c_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$; +var $n_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$; + +function $m_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$) { + $n_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$ = new $c_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_JustPropsViaHookApi$ }; diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala index b7956f0ef..1a1951d71 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala @@ -1,11 +1,11 @@ package japgolly.scalajs.react.test.emissions -import java.lang.{Boolean => JBoolean} import japgolly.microlibs.testutil.TestUtil._ import japgolly.microlibs.utils.FileUtils import japgolly.scalajs.react.test.emissions.util._ -import scala.annotation.nowarn +import java.lang.{Boolean => JBoolean} import scala.Console._ +import scala.annotation.nowarn import scala.util.Try import utest._ import utest.framework.TestPath @@ -17,20 +17,23 @@ object ReactRefreshTest extends TestSuite { "version" - validateReactRefreshVersion() "js" - { - "fn" - testJs() - "hooks" - testJs() + "fn" - testJs() + "hooks" - testJs() "custom_hooks" - testJs() - // "temp" - testJs() + // "temp" - testJs() } "sjr" - { - "CustomHooks" - testScala(assertRR = false) // TODO: - "CustomHooksBy" - testScala(assertRR = false) // TODO: - "HooksWithJsFns" - testScala() - "HooksWithScalaFns" - testScala() - "HooksWithChildren" - testScala() - "UseState" - testScala() - "UseStateWithReuse" - testScala() + "CustomHooks" - testScala(assertRR = false) // TODO: + "CustomHooksBy" - testScala(assertRR = false) // TODO: + "HooksWithChildrenCtxFn" - testScala() + "HooksWithChildrenCtxObj" - testScala() + "HooksWithJsFns" - testScala() + "HooksWithScalaFns" - testScala() + "JustPropsChildrenViaHookApi" - testScala(assertRR = false) // TODO: + "JustPropsViaHookApi" - testScala(assertRR = false) // TODO: + "UseState" - testScala() + "UseStateWithReuse" - testScala() } } @@ -209,7 +212,8 @@ object ReactRefreshTest extends TestSuite { private def testOutputFromSig(js: String, expect: JBoolean): Any = if (expect == false) - "react-refresh not installed" + // "react-refresh not installed" + "-" else reactRefreshSignature(js) match { case Some(sig) => sig diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Babel.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Babel.scala index b0d48d672..4f68881a4 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Babel.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Babel.scala @@ -14,11 +14,24 @@ final case class Babel(before : String, } def assertRR(expectInstalled: Boolean = true)(implicit l: Line): Unit = { - val actual = Util.countRR(after) - val expect = if (expectInstalled) 1 else 0 - if (actual !=* expect) { - showBadOutput() - assertEq("RR installations", actual, expect) + + // Presense + locally { + val actual = Util.containsRR(after) + if (actual !=* expectInstalled) { + showBadOutput() + assertEq("RR installed?", actual, expectInstalled) + } + } + + // Count installations + locally { + val actual = Util.countRR(after) + val expect = if (expectInstalled) 1 else 0 + if (actual !=* expect) { + showBadOutput() + assertEq("RR installations", actual, expect) + } } } diff --git a/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksRRTest.scala b/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksRRTest.scala index ca2f45e13..53135fac0 100644 --- a/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksRRTest.scala +++ b/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksRRTest.scala @@ -112,6 +112,23 @@ object HooksRRTest extends TestSuite { // =================================================================================================================== + private def testProps(): Unit = { + val comp = ScalaFnComponent.withHooks[Int] + .renderRR(_ + 1) + + test(comp(3))(_ assertText "4") + } + + private def testPropsChildren(): Unit = { + val inner = ScalaFnComponent.withHooks[Int] + .withPropsChildren + .renderRR((p, c) => <.div(p + 1, " | ", c)) + + val comp = ScalaFnComponent[Int] { p => inner(p * 10)(<.p("yo!")) } + + test(comp(3))(_ assertText "31 | yo!") + } + private def testCustomHook(): Unit = { // TODO: https://github.com/lampepfl/dotty/issues/12663 ScalaSpecificHooksTest.testCustomHookRR() @@ -1277,9 +1294,40 @@ object HooksRRTest extends TestSuite { } } + private def testPropsChildrenCtxObj(): Unit = { + val inner = ScalaFnComponent.withHooks[Int] + .withPropsChildren + .useState(123) + .renderRR { $ => + val p = $.props + val c = $.propsChildren + val s = $.hook1 + <.div(p + 1, " | ", s.value, " | ", c) + } + + val comp = ScalaFnComponent[Int] { p => inner(p * 10)(<.p("yo!")) } + + test(comp(3))(_ assertText "31 | 123 | yo!") + } + + private def testPropsChildrenCtxFn(): Unit = { + val inner = ScalaFnComponent.withHooks[Int] + .withPropsChildren + .useState(123) + .renderRR((p, c, s) => <.div(p + 1, " | ", s.value, " | ", c)) + + val comp = ScalaFnComponent[Int] { p => inner(p * 10)(<.p("yo!")) } + + test(comp(3))(_ assertText "31 | 123 | yo!") + } + // =================================================================================================================== override def tests = Tests { + "noHooks" - { + "props" - testProps() + "propsChildren" - testPropsChildren() + } "custom" - { "usage" - testCustomHook() "composition" - testCustomHookComposition() @@ -1342,6 +1390,11 @@ object HooksRRTest extends TestSuite { "useStateSnapshot" - testUseStateSnapshot() "useStateSnapshotWithReuse" - testUseStateSnapshotWithReuse() + "withPropsChildren" - { + "ctxObj" - testPropsChildrenCtxObj() + "ctxFn" - testPropsChildrenCtxFn() + } + "renderWithReuse" - { "main" - testRenderWithReuse() "never" - testRenderWithReuseNever() diff --git a/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksTest.scala b/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksTest.scala index 72fb288c4..cf075cbdb 100644 --- a/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksTest.scala +++ b/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksTest.scala @@ -110,6 +110,23 @@ object HooksTest extends TestSuite { // =================================================================================================================== + private def testProps(): Unit = { + val comp = ScalaFnComponent.withHooks[Int] + .render(_ + 1) + + test(comp(3))(_ assertText "4") + } + + private def testPropsChildren(): Unit = { + val inner = ScalaFnComponent.withHooks[Int] + .withPropsChildren + .render((p, c) => <.div(p + 1, " | ", c)) + + val comp = ScalaFnComponent[Int] { p => inner(p * 10)(<.p("yo!")) } + + test(comp(3))(_ assertText "31 | yo!") + } + private def testCustomHook(): Unit = { // TODO: https://github.com/lampepfl/dotty/issues/12663 ScalaSpecificHooksTest.testCustomHook() @@ -1275,9 +1292,40 @@ object HooksTest extends TestSuite { } } + private def testPropsChildrenCtxObj(): Unit = { + val inner = ScalaFnComponent.withHooks[Int] + .withPropsChildren + .useState(123) + .render { $ => + val p = $.props + val c = $.propsChildren + val s = $.hook1 + <.div(p + 1, " | ", s.value, " | ", c) + } + + val comp = ScalaFnComponent[Int] { p => inner(p * 10)(<.p("yo!")) } + + test(comp(3))(_ assertText "31 | 123 | yo!") + } + + private def testPropsChildrenCtxFn(): Unit = { + val inner = ScalaFnComponent.withHooks[Int] + .withPropsChildren + .useState(123) + .render((p, c, s) => <.div(p + 1, " | ", s.value, " | ", c)) + + val comp = ScalaFnComponent[Int] { p => inner(p * 10)(<.p("yo!")) } + + test(comp(3))(_ assertText "31 | 123 | yo!") + } + // =================================================================================================================== override def tests = Tests { + "noHooks" - { + "props" - testProps() + "propsChildren" - testPropsChildren() + } "custom" - { "usage" - testCustomHook() "composition" - testCustomHookComposition() @@ -1340,6 +1388,11 @@ object HooksTest extends TestSuite { "useStateSnapshot" - testUseStateSnapshot() "useStateSnapshotWithReuse" - testUseStateSnapshotWithReuse() + "withPropsChildren" - { + "ctxObj" - testPropsChildrenCtxObj() + "ctxFn" - testPropsChildrenCtxFn() + } + "renderWithReuse" - { "main" - testRenderWithReuse() "never" - testRenderWithReuseNever() From c07533ac01286badb877cd2692586a84218a8792 Mon Sep 17 00:00:00 2001 From: David Barri Date: Mon, 20 Jun 2022 15:24:09 +1000 Subject: [PATCH 53/72] Support rewriting of `local*` and `unchecked*` hooks --- library/TODO.md | 130 ++++++++-------- library/aliases.sbt | 2 + .../scalajs/react/hooks/HookMacros.scala | 17 ++- .../scalajs/react/hooks/HookMacros.scala | 20 ++- .../react/hooks/AbstractHookMacros.scala | 82 ++++++---- .../react/test/emissions/HooksPrimative.scala | 31 ++++ .../scalajs/react/test/emissions/Main.scala | 1 + .../resources/rr-sjr/HooksPrimative-out2.js | 141 ++++++++++++++++++ .../resources/rr-sjr/HooksPrimative-out3.js | 123 +++++++++++++++ .../test/emissions/ReactRefreshTest.scala | 1 + .../react/test/emissions/util/TestJs.scala | 9 +- 11 files changed, 457 insertions(+), 100 deletions(-) create mode 100644 library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksPrimative.scala create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/HooksPrimative-out2.js create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/HooksPrimative-out3.js diff --git a/library/TODO.md b/library/TODO.md index 8f0475b73..aac69d5fd 100644 --- a/library/TODO.md +++ b/library/TODO.md @@ -1,71 +1,71 @@ ```scala // Api.scala -/* [--] */ def localLazyVal [A](a: => A)(implicit step: Step): step.Next[() => A] -/* [--] */ def localLazyValBy [A](f: Ctx => A)(implicit step: Step): step.Next[() => A] -/* [--] */ def localLazyValBy [A](f: CtxFn[A])(implicit step: Step): step.Next[() => A] -/* [--] */ def localVal [A](a: => A)(implicit step: Step): step.Next[A] -/* [--] */ def localValBy [A](f: Ctx => A)(implicit step: Step): step.Next[A] -/* [--] */ def localValBy [A](f: CtxFn[A])(implicit step: Step): step.Next[A] -/* [--] */ def localVar [A](a: => A)(implicit step: Step): step.Next[Var[A]] -/* [--] */ def localVarBy [A](f: Ctx => A)(implicit step: Step): step.Next[Var[A]] -/* [--] */ def localVarBy [A](f: CtxFn[A])(implicit step: Step): step.Next[Var[A]] -/* [--] */ def unchecked [A](f: => A)(implicit step: Step, d: DynamicNextStep[A]): d.OneOf[step.Self, step.Next[A]] -/* [--] */ def uncheckedBy [A](f: Ctx => A)(implicit step: Step, d: DynamicNextStep[A]): d.OneOf[step.Self, step.Next[A]] -/* [--] */ def uncheckedBy [A](f: CtxFn[A])(implicit step: Step, d: DynamicNextStep[A]): d.OneOf[step.Self, step.Next[A]] -/* [--] */ def useCallback [A](callback: A)(implicit a: UseCallbackArg[A], step: Step): step.Next[Reusable[A]] -/* [--] */ def useCallbackBy [A](callback: Ctx => A)(implicit a: UseCallbackArg[A], step: Step): step.Next[Reusable[A]] -/* [--] */ def useCallbackBy [A](callback: CtxFn[A])(implicit a: UseCallbackArg[A], step: Step): step.Next[Reusable[A]] -/* [--] */ def useCallbackWithDeps [D, A](deps: => D)(callback: D => A)(implicit a: UseCallbackArg[A], r: Reusability[D], step: Step): step.Next[Reusable[A]] -/* [--] */ def useCallbackWithDepsBy [D, A](deps: Ctx => D)(callback: Ctx => D => A)(implicit a: UseCallbackArg[A], r: Reusability[D], step: Step): step.Next[Reusable[A]] -/* [--] */ def useCallbackWithDepsBy [D, A](deps: CtxFn[D])(callback: CtxFn[D => A])(implicit a: UseCallbackArg[A], r: Reusability[D], step: Step): step.Next[Reusable[A]] -/* [--] */ def useContext [A](ctx: Context[A])(implicit step: Step): step.Next[A] -/* [--] */ def useContextBy [A](f: Ctx => Context[A])(implicit step: Step): step.Next[A] -/* [--] */ def useContextBy [A](f: CtxFn[Context[A]])(implicit step: Step): step.Next[A] -/* [--] */ def useDebugValue (desc: => Any)(implicit step: Step): step.Self -/* [--] */ def useDebugValueBy (desc: Ctx => Any)(implicit step: Step): step.Self -/* [--] */ def useDebugValueBy (f: CtxFn[Any])(implicit step: Step): step.Self -/* [--] */ def useEffect [A](effect: A)(implicit a: UseEffectArg[A], step: Step): step.Self -/* [--] */ def useEffectBy [A](init: Ctx => A)(implicit a: UseEffectArg[A], step: Step): step.Self -/* [--] */ def useEffectBy [A](init: CtxFn[A])(implicit a: UseEffectArg[A], step: Step): step.Self -/* [--] */ def useEffectOnMount [A](effect: A)(implicit a: UseEffectArg[A], step: Step): step.Self -/* [--] */ def useEffectOnMountBy [A](effect: Ctx => A)(implicit a: UseEffectArg[A], step: Step): step.Self -/* [--] */ def useEffectOnMountBy [A](effect: CtxFn[A])(implicit a: UseEffectArg[A], step: Step): step.Self -/* [--] */ def useEffectWithDeps [D, A](deps: => D)(effect: D => A)(implicit a: UseEffectArg[A], r: Reusability[D], step: Step): step.Self -/* [--] */ def useEffectWithDepsBy [D, A](deps: Ctx => D)(effect: Ctx => D => A)(implicit a: UseEffectArg[A], r: Reusability[D], step: Step): step.Self -/* [--] */ def useEffectWithDepsBy [D, A](deps: CtxFn[D])(effect: CtxFn[D => A])(implicit a: UseEffectArg[A], r: Reusability[D], step: Step): step.Self -/* [--] */ def useForceUpdate (implicit step: Step): step.Next[Reusable[DefaultEffects.Sync[Unit]]] -/* [--] */ def useLayoutEffect [A](effect: A)(implicit a: UseEffectArg[A], step: Step): step.Self -/* [--] */ def useLayoutEffectBy [A](init: Ctx => A)(implicit a: UseEffectArg[A], step: Step): step.Self -/* [--] */ def useLayoutEffectBy [A](init: CtxFn[A])(implicit a: UseEffectArg[A], step: Step): step.Self -/* [--] */ def useLayoutEffectOnMount [A](effect: A)(implicit a: UseEffectArg[A], step: Step): step.Self -/* [--] */ def useLayoutEffectOnMountBy [A](effect: Ctx => A)(implicit a: UseEffectArg[A], step: Step): step.Self -/* [--] */ def useLayoutEffectOnMountBy [A](effect: CtxFn[A])(implicit a: UseEffectArg[A], step: Step): step.Self -/* [--] */ def useLayoutEffectWithDeps [D, A](deps: => D)(effect: D => A)(implicit a: UseEffectArg[A], r: Reusability[D], step: Step): step.Self -/* [--] */ def useLayoutEffectWithDepsBy [D, A](deps: Ctx => D)(effect: Ctx => D => A)(implicit a: UseEffectArg[A], r: Reusability[D], step: Step): step.Self -/* [--] */ def useLayoutEffectWithDepsBy [D, A](deps: CtxFn[D])(effect: CtxFn[D => A])(implicit a: UseEffectArg[A], r: Reusability[D], step: Step): step.Self -/* [--] */ def useMemo [D, A](deps: => D)(create: D => A)(implicit r: Reusability[D], step: Step): step.Next[Reusable[A]] -/* [--] */ def useMemoBy [D, A](deps: Ctx => D)(create: Ctx => D => A)(implicit r: Reusability[D], step: Step): step.Next[Reusable[A]] -/* [--] */ def useMemoBy [D, A](deps: CtxFn[D])(create: CtxFn[D => A])(implicit r: Reusability[D], step: Step): step.Next[Reusable[A]] -/* [--] */ def useReducer [S, A](reducer: (S, A) => S, initialState: => S)(implicit step: Step): step.Next[UseReducer[S, A]] -/* [--] */ def useReducerBy [S, A](reducer: Ctx => (S, A) => S, initialState: Ctx => S)(implicit step: Step): step.Next[UseReducer[S, A]] -/* [--] */ def useReducerBy [S, A](reducer: CtxFn[(S, A) => S], initialState: CtxFn[S])(implicit step: Step): step.Next[UseReducer[S, A]] -/* [--] */ def useRef [A](initialValue: => A)(implicit step: Step): step.Next[UseRef[A]] -/* [--] */ def useRefBy [A](f: CtxFn[A])(implicit step: Step): step.Next[UseRef[A]] -/* [--] */ def useRefBy [A](initialValue: Ctx => A)(implicit step: Step): step.Next[UseRef[A]] -/* [--] */ def useRefToAnyVdom (implicit step: Step): step.Next[Ref.ToAnyVdom] -/* [--] */ def useRefToJsComponent [F[_], A[_], P1, S1, CT1[-p, +u] <: CtorType[p, u], R <: JsComponent.RawMounted[P0, S0], P0 <: js.Object, S0 <: js.Object, CT0[-p, +u] <: CtorType[p, u -/* [--] */ def useRefToJsComponent [P <: js.Object, S <: js.Object](implicit step: Step): step.Next[Ref.ToJsComponent[P, S, JsComponent.RawMounted[P, S]]] -/* [--] */ def useRefToJsComponentWithMountedFacade[P <: js.Object, S <: js.Object, F <: js.Object](implicit step: Step): step.Next[Ref.ToJsComponent[P, S, JsComponent.RawMounted[P, S] with F]] -/* [--] */ def useRefToScalaComponent [P, S, B, CT[-p, +u] <: CtorType[p, u -/* [--] */ def useRefToScalaComponent [P, S, B](implicit step: Step): step.Next[Ref.ToScalaComponent[P, S, B]] -/* [--] */ def useRefToVdom [N <: TopNode: ClassTag](implicit step: Step): step.Next[Ref.ToVdom[N]] -/* [--] */ def renderReusable [A](f: Ctx => Reusable[A])(implicit s: CtorType.Summoner[Box[P], C], v: A => VdomNode): Component[P, s.CT] -/* [--] */ def renderReusable [A](f: CtxFn[Reusable[A]])(implicit step: Step, s: CtorType.Summoner[Box[P], C], v: A => VdomNode): Component[P, s.CT] -/* [--] */ def renderWithReuse (f: Ctx => VdomNode)(implicit s: CtorType.Summoner[Box[P], C], r: Reusability[Ctx]): Component[P, s.CT] -/* [--] */ def renderWithReuse (f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C], r: Reusability[Ctx]): Component[P, s.CT] -/* [--] */ def renderWithReuseBy [A](reusableInputs: Ctx => A)(f: A => VdomNode)(implicit s: CtorType.Summoner[Box[P], C], r: Reusability[A]): Component[P, s.CT] -/* [--] */ def renderWithReuseBy [A](reusableInputs: CtxFn[A])(f: A => VdomNode)(implicit step: Step, s: CtorType.Summoner[Box[P], C], r: Reusability[A]): Component[P, s.CT] +def useCallback [A](callback: A)(implicit a: UseCallbackArg[A], step: Step): step.Next[Reusable[A]] +def useCallbackBy [A](callback: Ctx => A)(implicit a: UseCallbackArg[A], step: Step): step.Next[Reusable[A]] +def useCallbackBy [A](callback: CtxFn[A])(implicit a: UseCallbackArg[A], step: Step): step.Next[Reusable[A]] + +def useCallbackWithDeps [D, A](deps: => D)(callback: D => A)(implicit a: UseCallbackArg[A], r: Reusability[D], step: Step): step.Next[Reusable[A]] +def useCallbackWithDepsBy [D, A](deps: Ctx => D)(callback: Ctx => D => A)(implicit a: UseCallbackArg[A], r: Reusability[D], step: Step): step.Next[Reusable[A]] +def useCallbackWithDepsBy [D, A](deps: CtxFn[D])(callback: CtxFn[D => A])(implicit a: UseCallbackArg[A], r: Reusability[D], step: Step): step.Next[Reusable[A]] + +def useContext [A](ctx: Context[A])(implicit step: Step): step.Next[A] +def useContextBy [A](f: Ctx => Context[A])(implicit step: Step): step.Next[A] +def useContextBy [A](f: CtxFn[Context[A]])(implicit step: Step): step.Next[A] + +def useDebugValue (desc: => Any)(implicit step: Step): step.Self +def useDebugValueBy (desc: Ctx => Any)(implicit step: Step): step.Self +def useDebugValueBy (f: CtxFn[Any])(implicit step: Step): step.Self + +def useEffect [A](effect: A)(implicit a: UseEffectArg[A], step: Step): step.Self +def useEffectBy [A](init: Ctx => A)(implicit a: UseEffectArg[A], step: Step): step.Self +def useEffectBy [A](init: CtxFn[A])(implicit a: UseEffectArg[A], step: Step): step.Self +def useEffectOnMount [A](effect: A)(implicit a: UseEffectArg[A], step: Step): step.Self +def useEffectOnMountBy [A](effect: Ctx => A)(implicit a: UseEffectArg[A], step: Step): step.Self +def useEffectOnMountBy [A](effect: CtxFn[A])(implicit a: UseEffectArg[A], step: Step): step.Self +def useForceUpdate (implicit step: Step): step.Next[Reusable[DefaultEffects.Sync[Unit]]] + +def useEffectWithDeps [D, A](deps: => D)(effect: D => A)(implicit a: UseEffectArg[A], r: Reusability[D], step: Step): step.Self +def useEffectWithDepsBy [D, A](deps: Ctx => D)(effect: Ctx => D => A)(implicit a: UseEffectArg[A], r: Reusability[D], step: Step): step.Self +def useEffectWithDepsBy [D, A](deps: CtxFn[D])(effect: CtxFn[D => A])(implicit a: UseEffectArg[A], r: Reusability[D], step: Step): step.Self + +def useLayoutEffect [A](effect: A)(implicit a: UseEffectArg[A], step: Step): step.Self +def useLayoutEffectBy [A](init: Ctx => A)(implicit a: UseEffectArg[A], step: Step): step.Self +def useLayoutEffectBy [A](init: CtxFn[A])(implicit a: UseEffectArg[A], step: Step): step.Self +def useLayoutEffectOnMount [A](effect: A)(implicit a: UseEffectArg[A], step: Step): step.Self +def useLayoutEffectOnMountBy [A](effect: Ctx => A)(implicit a: UseEffectArg[A], step: Step): step.Self +def useLayoutEffectOnMountBy [A](effect: CtxFn[A])(implicit a: UseEffectArg[A], step: Step): step.Self + +def useLayoutEffectWithDeps [D, A](deps: => D)(effect: D => A)(implicit a: UseEffectArg[A], r: Reusability[D], step: Step): step.Self +def useLayoutEffectWithDepsBy [D, A](deps: Ctx => D)(effect: Ctx => D => A)(implicit a: UseEffectArg[A], r: Reusability[D], step: Step): step.Self +def useLayoutEffectWithDepsBy [D, A](deps: CtxFn[D])(effect: CtxFn[D => A])(implicit a: UseEffectArg[A], r: Reusability[D], step: Step): step.Self + +def useMemo [D, A](deps: => D)(create: D => A)(implicit r: Reusability[D], step: Step): step.Next[Reusable[A]] +def useMemoBy [D, A](deps: Ctx => D)(create: Ctx => D => A)(implicit r: Reusability[D], step: Step): step.Next[Reusable[A]] +def useMemoBy [D, A](deps: CtxFn[D])(create: CtxFn[D => A])(implicit r: Reusability[D], step: Step): step.Next[Reusable[A]] + +def useReducer [S, A](reducer: (S, A) => S, initialState: => S)(implicit step: Step): step.Next[UseReducer[S, A]] +def useReducerBy [S, A](reducer: Ctx => (S, A) => S, initialState: Ctx => S)(implicit step: Step): step.Next[UseReducer[S, A]] +def useReducerBy [S, A](reducer: CtxFn[(S, A) => S], initialState: CtxFn[S])(implicit step: Step): step.Next[UseReducer[S, A]] + +def useRef [A](initialValue: => A)(implicit step: Step): step.Next[UseRef[A]] +def useRefBy [A](f: CtxFn[A])(implicit step: Step): step.Next[UseRef[A]] +def useRefBy [A](initialValue: Ctx => A)(implicit step: Step): step.Next[UseRef[A]] +def useRefToAnyVdom (implicit step: Step): step.Next[Ref.ToAnyVdom] +def useRefToJsComponent [F[_], A[_], P1, S1, CT1[-p, +u] <: CtorType[p, u], R <: JsComponent.RawMounted[P0, S0], P0 <: js.Object, S0 <: js.Object, CT0[-p, +u] <: CtorType[p, u +def useRefToJsComponent [P <: js.Object, S <: js.Object](implicit step: Step): step.Next[Ref.ToJsComponent[P, S, JsComponent.RawMounted[P, S]]] +def useRefToJsComponentWithMountedFacade[P <: js.Object, S <: js.Object, F <: js.Object](implicit step: Step): step.Next[Ref.ToJsComponent[P, S, JsComponent.RawMounted[P, S] with F]] +def useRefToScalaComponent [P, S, B, CT[-p, +u] <: CtorType[p, u +def useRefToScalaComponent [P, S, B](implicit step: Step): step.Next[Ref.ToScalaComponent[P, S, B]] +def useRefToVdom [N <: TopNode: ClassTag](implicit step: Step): step.Next[Ref.ToVdom[N]] + +def renderReusable [A](f: Ctx => Reusable[A])(implicit s: CtorType.Summoner[Box[P], C], v: A => VdomNode): Component[P, s.CT] +def renderReusable [A](f: CtxFn[Reusable[A]])(implicit step: Step, s: CtorType.Summoner[Box[P], C], v: A => VdomNode): Component[P, s.CT] + +def renderWithReuse (f: Ctx => VdomNode)(implicit s: CtorType.Summoner[Box[P], C], r: Reusability[Ctx]): Component[P, s.CT] +def renderWithReuse (f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C], r: Reusability[Ctx]): Component[P, s.CT] +def renderWithReuseBy [A](reusableInputs: Ctx => A)(f: A => VdomNode)(implicit s: CtorType.Summoner[Box[P], C], r: Reusability[A]): Component[P, s.CT] +def renderWithReuseBy [A](reusableInputs: CtxFn[A])(f: A => VdomNode)(implicit step: Step, s: CtorType.Summoner[Box[P], C], r: Reusability[A]): Component[P, s.CT] // Custom hooks need rewriting too - see the JS only example. This is going to be time-consuming... Will have to make it low-priority for now... ``` diff --git a/library/aliases.sbt b/library/aliases.sbt index 691f1d094..4ce9e9310 100644 --- a/library/aliases.sbt +++ b/library/aliases.sbt @@ -14,5 +14,7 @@ addCommandAlias("TU", "project testUtil") addCommandAlias("tcc", "compile; Test/clean; Test/compile") addCommandAlias("tt", "tests/test") +addCommandAlias("th", "coreGeneric/compile; tests/testOnly *Hook*") +addCommandAlias("thc", "coreGeneric/compile; tests/Test/clean; tests/testOnly *Hook*") addCommandAlias("te", "testEmissions/test") addCommandAlias("tec", "testEmissionsJS/clean;testEmissions/test") diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala index 73847b2d4..d46d3d007 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -78,10 +78,10 @@ class HookMacros(val c: Context) extends MacroUtils { override protected def unitType = c.universe.definitions.UnitTpe override protected def wrap = (s, b) => Block(s.toList, b) - override protected def call = (function, args) => { + override protected def call = (function, args, betaReduce) => { import internal._ function match { - case Function(params, body) => + case Function(params, body) if betaReduce => // From scala/test/files/run/macro-range/Common_1.scala class TreeSubstituter(from: List[Symbol], to: List[Tree]) extends Transformer { @@ -111,7 +111,12 @@ class HookMacros(val c: Context) extends MacroUtils { apply = Apply(_, _), hookCtx = (c, as) => Apply(if (c) q"$HookCtx.withChildren" else HookCtx, as), refToTerm = r => Ident(r), - valDef = (n, t) => { val r = TermName(n); (q"val $r = $t", r) }, + scalaVer = 2, + valDef = (n, t, l) => { + val r = TermName(n) + val stmt = if (l) q"lazy val $r = $t" else q"val $r = $t" + (stmt, r) + }, ) override val ApplyLike = new ApplyExtractor { @@ -161,6 +166,12 @@ class HookMacros(val c: Context) extends MacroUtils { override protected def customArg[Ctx, Arg] = (_, _, hookArg, ctx) => q"$hookArg.convert($ctx)" + override protected def hooksVar[A] = (_, body) => + q"$Hooks.Var($body)" + + override protected def scalaFn0[A] = (_, body) => + q"() => $body" + override protected def useStateFn[S] = (tpe, body) => q"$React.useStateFn(() => $Box[$tpe]($body))" diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala index 07e01051a..708768f36 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala @@ -161,10 +161,13 @@ object HookMacros { case _ => t } - override protected def call = (function, args) => { + override protected def call = (function, args, betaReduce) => { val f = extractFunction(function) val t = Apply(Select.unique(f, "apply"), args) - Term.betaReduce(t).getOrElse(t) + if (betaReduce) + Term.betaReduce(t).getOrElse(t) + else + t } @tailrec @@ -198,7 +201,12 @@ object HookMacros { Select.overloaded('{HookCtx}.asTerm, "apply", args.map(_.tpe), args) }, refToTerm = _.ref, - valDef = (n, t) => { val r = untypedValDef(n, t.tpe, Flags.EmptyFlags)(t); (r.valDef, r) }, + scalaVer = 3, + valDef = (n, t, l) => { + val flags = if (l) Flags.Lazy else Flags.EmptyFlags + val r = untypedValDef(n, t.tpe, flags)(t) + (r.valDef, r) + }, ) override val ApplyLike = new ApplyExtractor { @@ -264,6 +272,12 @@ object HookMacros { override protected def customArg[Ctx, Arg] = implicit (tc, ta, hookArg, ctx) => '{ $hookArg.convert($ctx) } + override protected def hooksVar[A] = implicit (tpe, body) => + '{ Hooks.Var[$tpe]($body) } + + override protected def scalaFn0[A] = implicit (tpe, body) => + '{ () => $body } + override protected def useStateFn[S] = implicit (tpe, body) => '{ React.useStateFn(() => Box[$tpe]($body)) } diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala index c6d54710e..bd678b205 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala @@ -2,6 +2,7 @@ package japgolly.scalajs.react.hooks import japgolly.scalajs.react.Reusability import japgolly.scalajs.react.facade.React +import japgolly.scalajs.react.hooks.Hooks import japgolly.scalajs.react.internal.{Box, MacroLogger} import japgolly.scalajs.react.vdom.VdomNode import scala.annotation.{nowarn, tailrec} @@ -100,21 +101,17 @@ object AbstractHookMacros { } else Some(createHook(body)) - final def createRawAndHook(raw: Term, hook: Ref => Term): Ref = { - val rawDef = valDef(raw, "_raw") - createHook(hook(rawDef)) - } + final def createRaw(body: Term, isLazy: Boolean = false): Ref = + valDef(body, "_raw", isLazy = isLazy) - final def createRawAndHook(raw: Term, hook: Ref => Term, discard: Boolean): Option[Ref] = { - val rawDef = valDef(raw, "_raw") - createHook(hook(rawDef), discard = discard) - } + @inline final def isScala2 = bridge.isScala2 + @inline final def isScala3 = bridge.isScala3 final def stmts() = _stmts - final def valDef(body: Term, suffix: String): Ref = { - val x = bridge.valDef(hookName + suffix, body) + final def valDef(body: Term, suffix: String, isLazy: Boolean = false): Ref = { + val x = bridge.valDef(hookName + suffix, body, isLazy) this += x._1 x._2 } @@ -128,8 +125,12 @@ object AbstractHookMacros { apply : (Term, List[Term]) => Term, hookCtx : (Boolean, List[Term]) => Term, refToTerm: Ref => Term, - valDef : (String, Term) => (Stmt, Ref), - ) + scalaVer : Int, + valDef : (String, Term, Boolean) => (Stmt, Ref), // Bool = isLazy + ) { + @inline def isScala2 = scalaVer == 2 + @inline def isScala3 = scalaVer == 3 + } def init[Stmt, Term <: Stmt, Ref](ctx : InitialCtx[Stmt, Term], bridg : Bridge[Stmt, Term, Ref], @@ -189,7 +190,7 @@ trait AbstractHookMacros { } protected def asTerm [A]: Expr[A] => Term - protected def call : (Term, List[Term]) => Term + protected def call : (Term, List[Term], Boolean) => Term // Bool = betaReduce (i.e. inline args) protected def Expr [A]: Term => Expr[A] protected def isUnit : TypeTree => Boolean protected def refToTerm : Ref => Term @@ -205,6 +206,8 @@ trait AbstractHookMacros { protected def custom[I, O]: (Type[I], Type[O], Expr[CustomHook[I, O]], Expr[I]) => Expr[O] protected def customArg[C, A]: (Type[C], Type[A], Expr[CustomHook.Arg[C, A]], Expr[C]) => Expr[A] + protected def hooksVar[A]: (Type[A], Expr[A]) => Expr[Hooks.Var[A]] + protected def scalaFn0[A]: (Type[A], Expr[A]) => Expr[() => A] protected def useStateFn[S]: (Type[S], Expr[S]) => Expr[React.UseState[Box[S]]] protected def useStateFromJsBoxed[S]: (Type[S], Expr[React.UseState[Box[S]]]) => Expr[Hooks.UseState[S]] protected def useStateWithReuseFromJsBoxed[S]: (Type[S], Expr[React.UseState[Box[S]]], Expr[Reusability[S]], Expr[ClassTag[S]]) => Expr[Hooks.UseStateWithReuse[S]] @@ -312,21 +315,22 @@ trait AbstractHookMacros { def rewriteStep(step: HookStep): Either[() => String, Rewriter => Option[Ref]] = { log("rewriteStep:" + step.name, step) - def by[A](fn: Term)(use: (Rewriter, Term => Term) => A): Either[() => String, Rewriter => A] = + def by[A](fn: Term, betaReduce: Rewriter => Boolean = null)(use: (Rewriter, Term => Term) => A): Either[() => String, Rewriter => A] = fn match { case FunctionLike(paramCount) => Right { b => val args = b.argsOrCtxArg(paramCount) - use(b, call(_, args)) + val br = if (betaReduce eq null) true else betaReduce(b) + use(b, call(_, args, br)) } case _ => Left(() => s"Expected a function, found: ${showRaw(fn)}") } - def maybeBy[A](f: Term)(use: (Rewriter, Term => Term) => A): Either[() => String, Rewriter => A] = + def maybeBy[A](f: Term, betaReduce: Rewriter => Boolean = null)(use: (Rewriter, Term => Term) => A): Either[() => String, Rewriter => A] = if (step.name endsWith "By") - by(f)(use) + by(f, betaReduce = betaReduce)(use) else Right(use(_, identity)) @@ -359,10 +363,34 @@ trait AbstractHookMacros { case "customBy" => val (List(o), List(List(h), List(_, _))) = step.sig : @nowarn by(h) { (b, withCtx) => - b.createRawAndHook( - raw = withCtx(h), - hook = custom[Unit, X](unitType, o, _, unitTerm), - discard = isUnit(o)) + val raw = b.createRaw(withCtx(h)) + b.createHook(custom[Unit, X](unitType, o, raw, unitTerm), discard = isUnit(o)) + } + + case "localVal" | "localValBy" => + val (List(_), List(List(valueFn), List(_))) = step.sig : @nowarn + maybeBy(valueFn) { (b, withCtx) => + b.createHook(withCtx(valueFn)) + } + + case "localLazyVal" | "localLazyValBy" => + val (List(tpe), List(List(valueFn), List(_))) = step.sig : @nowarn + // Here we avoid beta-reduction in Scala 3 because it causes a crash if props are referenced + maybeBy(valueFn, betaReduce = _.isScala2) { (b, withCtx) => + val raw = b.createRaw(withCtx(valueFn), isLazy = true) + b.createHook(scalaFn0[X](tpe, raw)) + } + + case "localVar" | "localVarBy" => + val (List(tpe), List(List(valueFn), List(_))) = step.sig : @nowarn + maybeBy(valueFn) { (b, withCtx) => + b.createHook(hooksVar[X](tpe, withCtx(valueFn))) + } + + case "unchecked" | "uncheckedBy" => + val (List(tpe), List(List(valueFn), List(_, _))) = step.sig : @nowarn + maybeBy(valueFn) { (b, withCtx) => + b.createHook(withCtx(valueFn), discard = isUnit(tpe)) } // case "useMemo" | "useMemoBy" => @@ -373,17 +401,15 @@ trait AbstractHookMacros { case "useState" | "useStateBy" => val (List(tpe), List(List(initialState), List(_))) = step.sig : @nowarn maybeBy(initialState) { (b, withCtx) => - b.createRawAndHook( - raw = useStateFn[X](tpe, withCtx(initialState)), - hook = useStateFromJsBoxed[X](tpe, _)) + val raw = b.createRaw(useStateFn[X](tpe, withCtx(initialState))) + b.createHook(useStateFromJsBoxed[X](tpe, raw)) } case "useStateWithReuse" | "useStateWithReuseBy" => val (List(tpe), List(List(initialState), List(ct, reuse, _))) = step.sig : @nowarn maybeBy(initialState) { (b, withCtx) => - b.createRawAndHook( - raw = useStateFn[X](tpe, withCtx(initialState)), - hook = useStateWithReuseFromJsBoxed[X](tpe, _, reuse, ct)) + val raw = b.createRaw(useStateFn[X](tpe, withCtx(initialState))) + b.createHook(useStateWithReuseFromJsBoxed[X](tpe, raw, reuse, ct)) } case _ => @@ -403,7 +429,7 @@ trait AbstractHookMacros { case FunctionLike(paramCount) => Right { b => val args = b.argsOrCtxArg(paramCount) - call(fn, args) + call(fn, args, true) } case _ => diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksPrimative.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksPrimative.scala new file mode 100644 index 000000000..dd5c33d68 --- /dev/null +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksPrimative.scala @@ -0,0 +1,31 @@ +package japgolly.scalajs.react.test.emissions + +import japgolly.scalajs.react._ +import japgolly.scalajs.react.vdom.html_<^._ +import org.scalajs.dom.console + +object HooksPrimative { + + val Component = ScalaFnComponent.withHooks[Unit] + + .localVal(1111) + .localValBy(_ => 2222) + .localValBy((_, _, _) => 3333) + + .localLazyVal(4444) + .localLazyValBy(_ => 5555) + .localLazyValBy((_, _, _, _, _, _) => 6666) + + .localVar(7777) + .localVarBy(_ => 8888) + .localVarBy((_, _, _, _, _, _, _, _, _) => 9999) + + .unchecked(console.log("aaaaa")) + .uncheckedBy(_ => "bbbbb") + .uncheckedBy((_, _, _, _, _, _, _, _, _, _, _) => console.log("ccccc")) + + .renderRR { (_, a, b, c, d, e, f, g, h, i, j) => + val sum = a + b + c + d() + e() + f() + g.value + h.value + i.value + j.length + sum + } +} diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala index cc4d553d7..f284b3b2f 100644 --- a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala @@ -16,6 +16,7 @@ object Main { <.div( CustomHooks .Component(0), CustomHooksBy .Component(0), + HooksPrimative .Component(), HooksWithChildrenCtxFn .Component(0)(<.div), HooksWithChildrenCtxObj .Component(0)(<.div), HooksWithJsFns .Component(0), diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksPrimative-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksPrimative-out2.js new file mode 100644 index 000000000..7064a7313 --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksPrimative-out2.js @@ -0,0 +1,141 @@ +'use strict'; + +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P1 from "./japgolly.scalajs.react.hooks.HookCtx$P1.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P4 from "./japgolly.scalajs.react.hooks.HookCtx$P4.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P7 from "./japgolly.scalajs.react.hooks.HookCtx$P7.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P9 from "./japgolly.scalajs.react.hooks.HookCtx$P9.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024VarF from "./japgolly.scalajs.react.hooks.Hooks$VarF.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 from "./japgolly.scalajs.react.internal.Singleton$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024 from "./japgolly.scalajs.react.util.DefaultEffects$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eNullPointerException from "./java.lang.NullPointerException.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002eruntime$002eLazyInt from "./scala.runtime.LazyInt.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; + +function $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook4_raw$lzycompute$1__sr_LazyInt__I($thiz, hook4_raw$lzy$1) { + if (hook4_raw$lzy$1 === null) { + throw new $j_java$002elang$002eNullPointerException.$c_jl_NullPointerException(); + } + + ; + return hook4_raw$lzy$1.sr_LazyInt__f__initialized ? hook4_raw$lzy$1.sr_LazyInt__f__value : hook4_raw$lzy$1.initialize__I__I(4444); +} + +export { $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook4_raw$lzycompute$1__sr_LazyInt__I }; + +function $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook4_raw$1__sr_LazyInt__I($thiz, hook4_raw$lzy$1) { + return hook4_raw$lzy$1.sr_LazyInt__f__initialized ? hook4_raw$lzy$1.sr_LazyInt__f__value : $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook4_raw$lzycompute$1__sr_LazyInt__I($thiz, hook4_raw$lzy$1); +} + +export { $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook4_raw$1__sr_LazyInt__I }; + +function $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook5_raw$lzycompute$1__sr_LazyInt__I($thiz, hook5_raw$lzy$1) { + if (hook5_raw$lzy$1 === null) { + throw new $j_java$002elang$002eNullPointerException.$c_jl_NullPointerException(); + } + + ; + return hook5_raw$lzy$1.sr_LazyInt__f__initialized ? hook5_raw$lzy$1.sr_LazyInt__f__value : hook5_raw$lzy$1.initialize__I__I(5555); +} + +export { $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook5_raw$lzycompute$1__sr_LazyInt__I }; + +function $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook5_raw$1__sr_LazyInt__I($thiz, hook5_raw$lzy$1) { + return hook5_raw$lzy$1.sr_LazyInt__f__initialized ? hook5_raw$lzy$1.sr_LazyInt__f__value : $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook5_raw$lzycompute$1__sr_LazyInt__I($thiz, hook5_raw$lzy$1); +} + +export { $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook5_raw$1__sr_LazyInt__I }; + +function $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook6_raw$lzycompute$1__sr_LazyInt__I($thiz, hook6_raw$lzy$1) { + if (hook6_raw$lzy$1 === null) { + throw new $j_java$002elang$002eNullPointerException.$c_jl_NullPointerException(); + } + + ; + return hook6_raw$lzy$1.sr_LazyInt__f__initialized ? hook6_raw$lzy$1.sr_LazyInt__f__value : hook6_raw$lzy$1.initialize__I__I(6666); +} + +export { $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook6_raw$lzycompute$1__sr_LazyInt__I }; + +function $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook6_raw$1__sr_LazyInt__I($thiz, hook6_raw$lzy$1) { + return hook6_raw$lzy$1.sr_LazyInt__f__initialized ? hook6_raw$lzy$1.sr_LazyInt__f__value : $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook6_raw$lzycompute$1__sr_LazyInt__I($thiz, hook6_raw$lzy$1); +} + +export { $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook6_raw$1__sr_LazyInt__I }; + +function $c_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$() { + this.Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__f_Component = null; + $n_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$ = this; + + var rawComponent = arg1$2 => $m_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$().japgolly$scalajs$react$test$emissions$HooksPrimative$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2); + + var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonN__Ljapgolly_scalajs_react_internal_Singleton__Ljapgolly_scalajs_react_CtorType$Summoner($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$().Ljapgolly_scalajs_react_internal_Singleton$__f_BoxUnit); + this.Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$1.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$ }; +$c_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$; + +function $h_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$ }; +$h_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$.prototype; + +$c_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$.prototype.japgolly$scalajs$react$test$emissions$HooksPrimative$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = function (props) { + var hook4_raw$lzy = new $j_scala$002eruntime$002eLazyInt.$c_sr_LazyInt(); + var hook5_raw$lzy = new $j_scala$002eruntime$002eLazyInt.$c_sr_LazyInt(); + var hook6_raw$lzy = new $j_scala$002eruntime$002eLazyInt.$c_sr_LazyInt(); + var props$1 = props.a; + $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P1.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P1__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P1.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P1(), props$1, 1111); + var hook4 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((this$2, hook4_raw$lzy$1) => () => $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook4_raw$1__sr_LazyInt__I(this$2, hook4_raw$lzy$1))(this, hook4_raw$lzy)); + var props$2 = props.a; + $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P4.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P4__O__O__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P4.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P4(), props$2, 1111, 2222, 3333, hook4); + var hook5 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((this$2$1, hook5_raw$lzy$1) => () => $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook5_raw$1__sr_LazyInt__I(this$2$1, hook5_raw$lzy$1))(this, hook5_raw$lzy)); + var hook6 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((this$3$1, hook6_raw$lzy$1) => () => $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook6_raw$1__sr_LazyInt__I(this$3$1, hook6_raw$lzy$1))(this, hook6_raw$lzy)); + var this$5 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); + var hook7 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024VarF.$c_Ljapgolly_scalajs_react_hooks_Hooks$VarF(7777, this$5.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + var props$3 = props.a; + $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P7.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P7__O__O__O__O__O__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P7.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P7(), props$3, 1111, 2222, 3333, hook4, hook5, hook6, hook7); + var this$8 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); + var hook8 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024VarF.$c_Ljapgolly_scalajs_react_hooks_Hooks$VarF(8888, this$8.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + var this$10 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); + var hook9 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024VarF.$c_Ljapgolly_scalajs_react_hooks_Hooks$VarF(9999, this$10.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + console.log("aaaaa"); + var props$4 = props.a; + new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P9.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P9(props$4, 1111, 2222, 3333, hook4, hook5, hook6, hook7, hook8, hook9); + console.log("ccccc"); + var sum = ((((((6666 + (hook4.apply__O() | 0) | 0) + (hook5.apply__O() | 0) | 0) + (hook6.apply__O() | 0) | 0) + (hook7.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + (hook8.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + (hook9.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + ("bbbbb".length | 0) | 0; + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + return new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; +}; + +var $d_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_HooksPrimative$: 0 +}, false, "japgolly.scalajs.react.test.emissions.HooksPrimative$", { + Ljapgolly_scalajs_react_test_emissions_HooksPrimative$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$ }; +$c_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$; +var $n_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$; + +function $m_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$) { + $n_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$ = new $c_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksPrimative-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksPrimative-out3.js new file mode 100644 index 000000000..8f2cc64bc --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksPrimative-out3.js @@ -0,0 +1,123 @@ +'use strict'; + +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P1 from "./japgolly.scalajs.react.hooks.HookCtx$P1.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P4 from "./japgolly.scalajs.react.hooks.HookCtx$P4.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P7 from "./japgolly.scalajs.react.hooks.HookCtx$P7.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P9 from "./japgolly.scalajs.react.hooks.HookCtx$P9.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024VarF from "./japgolly.scalajs.react.hooks.Hooks$VarF.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 from "./japgolly.scalajs.react.internal.Singleton$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024 from "./japgolly.scalajs.react.util.DefaultEffects$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eNullPointerException from "./java.lang.NullPointerException.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002eruntime$002eLazyInt from "./scala.runtime.LazyInt.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; + +function $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook5_raw$lzyINIT1$1__sr_LazyInt__I($thiz, hook5_raw$lzy1$1) { + if (hook5_raw$lzy1$1 === null) { + throw new $j_java$002elang$002eNullPointerException.$c_jl_NullPointerException(); + } + + ; + return hook5_raw$lzy1$1.sr_LazyInt__f__initialized ? hook5_raw$lzy1$1.sr_LazyInt__f__value : hook5_raw$lzy1$1.initialize__I__I(5555); +} + +export { $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook5_raw$lzyINIT1$1__sr_LazyInt__I }; + +function $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook5_raw$1__sr_LazyInt__I($thiz, hook5_raw$lzy1$2) { + return hook5_raw$lzy1$2.sr_LazyInt__f__initialized ? hook5_raw$lzy1$2.sr_LazyInt__f__value : $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook5_raw$lzyINIT1$1__sr_LazyInt__I($thiz, hook5_raw$lzy1$2); +} + +export { $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook5_raw$1__sr_LazyInt__I }; + +function $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook6_raw$lzyINIT1$1__sr_LazyInt__I($thiz, hook6_raw$lzy1$1) { + if (hook6_raw$lzy1$1 === null) { + throw new $j_java$002elang$002eNullPointerException.$c_jl_NullPointerException(); + } + + ; + return hook6_raw$lzy1$1.sr_LazyInt__f__initialized ? hook6_raw$lzy1$1.sr_LazyInt__f__value : hook6_raw$lzy1$1.initialize__I__I(6666); +} + +export { $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook6_raw$lzyINIT1$1__sr_LazyInt__I }; + +function $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook6_raw$1__sr_LazyInt__I($thiz, hook6_raw$lzy1$2) { + return hook6_raw$lzy1$2.sr_LazyInt__f__initialized ? hook6_raw$lzy1$2.sr_LazyInt__f__value : $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook6_raw$lzyINIT1$1__sr_LazyInt__I($thiz, hook6_raw$lzy1$2); +} + +export { $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook6_raw$1__sr_LazyInt__I }; + +function $c_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$() { + this.Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__f_Component = null; + $n_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$ = this; + + var rawComponent = (this$1 => props => { + new $j_scala$002eruntime$002eLazyInt.$c_sr_LazyInt(); + var hook5_raw$lzy1 = new $j_scala$002eruntime$002eLazyInt.$c_sr_LazyInt(); + var hook6_raw$lzy1 = new $j_scala$002eruntime$002eLazyInt.$c_sr_LazyInt(); + var props$1 = props.a; + $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P1.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P1__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P1.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P1(), props$1, 1111); + var hook4 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => 4444); + var props$2 = props.a; + $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P4.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P4__O__O__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P4.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P4(), props$2, 1111, 2222, 3333, hook4); + var hook5_raw$lzy1$2$1 = hook5_raw$lzy1; + var hook5 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((this$2$1, hook5_raw$lzy1$2) => () => $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook5_raw$1__sr_LazyInt__I(this$2$1, hook5_raw$lzy1$2))(this$1, hook5_raw$lzy1$2$1)); + var hook6_raw$lzy1$2$1 = hook6_raw$lzy1; + var hook6 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((this$3$1, hook6_raw$lzy1$2) => () => $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook6_raw$1__sr_LazyInt__I(this$3$1, hook6_raw$lzy1$2))(this$1, hook6_raw$lzy1$2$1)); + var this$6 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); + var hook7 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024VarF.$c_Ljapgolly_scalajs_react_hooks_Hooks$VarF(7777, this$6.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + var props$3 = props.a; + $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P7.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P7__O__O__O__O__O__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P7.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P7(), props$3, 1111, 2222, 3333, hook4, hook5, hook6, hook7); + var this$9 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); + var hook8 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024VarF.$c_Ljapgolly_scalajs_react_hooks_Hooks$VarF(8888, this$9.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + var this$11 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); + var hook9 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024VarF.$c_Ljapgolly_scalajs_react_hooks_Hooks$VarF(9999, this$11.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + console.log("aaaaa"); + var props$4 = props.a; + new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P9.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P9(props$4, 1111, 2222, 3333, hook4, hook5, hook6, hook7, hook8, hook9); + props.a; + console.log("ccccc"); + props.a; + var sum = ((((((6666 + (hook4.apply__O() | 0) | 0) + (hook5.apply__O() | 0) | 0) + (hook6.apply__O() | 0) | 0) + (hook7.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + (hook8.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + (hook9.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + ("bbbbb".length | 0) | 0; + return ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; + })(this); + + var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$15 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonN__Ljapgolly_scalajs_react_internal_Singleton__Ljapgolly_scalajs_react_CtorType$Summoner($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$().Ljapgolly_scalajs_react_internal_Singleton$__f_BoxUnit); + this.Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$15.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$ }; +$c_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$; + +function $h_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$ }; +$h_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$.prototype; +var $d_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_HooksPrimative$: 0 +}, false, "japgolly.scalajs.react.test.emissions.HooksPrimative$", { + Ljapgolly_scalajs_react_test_emissions_HooksPrimative$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$ }; +$c_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$; +var $n_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$; + +function $m_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$) { + $n_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$ = new $c_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$ }; diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala index 1a1951d71..ba8d8d329 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala @@ -26,6 +26,7 @@ object ReactRefreshTest extends TestSuite { "sjr" - { "CustomHooks" - testScala(assertRR = false) // TODO: "CustomHooksBy" - testScala(assertRR = false) // TODO: + "HooksPrimative" - testScala(assertRR = false) // TODO: "HooksWithChildrenCtxFn" - testScala() "HooksWithChildrenCtxObj" - testScala() "HooksWithJsFns" - testScala() diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala index 6658fcc9d..3e2ec05db 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala @@ -78,8 +78,15 @@ object TestJs { .filterNot(_ startsWith "import ") .modify(_ // Not sure why SJS sometimes emits one or the other of the following + .replace("PropsChildren$", "PropsChildren") - .replace("$FirstStep.$", "$First.$") // Scala 3 only + + // Scala 3 only for some reason + .replace("$FirstStep.$", "$First.$") + + // From: $j_sjr_hooks_HookCtx$P3.$ct_Lsjr_hooks_HookCtx$P3__O__O__O__O__(new $j_sjr_hooks_HookCtx$P3.$c_Lsjr_hooks_HookCtx$P3(), props$0, hook1, hook2, hook3); + // To: new $j_sjr_hooks_HookCtx$P3.$c_Lsjr_hooks_HookCtx$P3(props$0, hook1, hook2, hook3) + .replaceAll("""\$j_[a-zA-Z_]+?\$P\d+?\.\$[a-zA-Z_]+?\$P[0-9_O]+?\((new [a-zA-Z0-9$_.]+\()\), """, "$1") ) ) From de5e001540c3752127e785ca9f6902166f691eed Mon Sep 17 00:00:00 2001 From: David Barri Date: Mon, 20 Jun 2022 15:32:18 +1000 Subject: [PATCH 54/72] Tiny tweak - too tired to actually describe --- .../scalajs/react/hooks/AbstractHookMacros.scala | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala index bd678b205..ea96c3355 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala @@ -267,11 +267,11 @@ trait AbstractHookMacros { case ApplyLike(t, a) => _parse(t, targs, a :: args, steps) - case TypeApplyLike(t, a) => + case ta@ TypeApplyLike(t, a) => if (targs.isEmpty) _parse(t, a, args, steps) else - Left(() => "Multiple type arg clauses found at " + showRaw(tree)) + Left(() => "Multiple type arg clauses found at " + showRaw(ta)) case SelectLike(t, name) => if (name == withHooks) { @@ -285,8 +285,8 @@ trait AbstractHookMacros { _parse(t, Nil, Nil, step :: steps) } - case _ => - Left(() => "Don't know how to parse " + showRaw(tree)) + case t => + Left(() => "Don't know how to parse " + showRaw(t)) } // ------------------------------------------------------------------------------------------------------------------- @@ -423,9 +423,8 @@ trait AbstractHookMacros { step.name match { case "renderRR" | "renderRRDebug" => - val List(List(fn0), _) = step.args : @nowarn - val fn = uninline(fn0) - fn match { + val List(List(fn), _) = step.args : @nowarn + uninline(fn) match { case FunctionLike(paramCount) => Right { b => val args = b.argsOrCtxArg(paramCount) From f2c63def9da26eb5091c5ab3f1ce0380de0143c9 Mon Sep 17 00:00:00 2001 From: David Barri Date: Tue, 21 Jun 2022 09:16:00 +1000 Subject: [PATCH 55/72] Inline `HookCtx` stuff --- .../scalajs/react/hooks/HookCtx.scala | 425 +++++++++--------- library/project/GenHooks.scala | 43 +- .../resources/rr-sjr/CustomHooksBy-out2.js | 15 +- .../resources/rr-sjr/CustomHooksBy-out3.js | 21 +- .../resources/rr-sjr/HooksPrimative-out2.js | 34 +- .../resources/rr-sjr/HooksPrimative-out3.js | 42 +- .../rr-sjr/HooksWithChildrenCtxFn-out2.js | 6 +- .../rr-sjr/HooksWithChildrenCtxObj-out2.js | 11 +- .../rr-sjr/HooksWithChildrenCtxObj-out3.js | 15 +- .../resources/rr-sjr/HooksWithJsFns-out2.js | 2 +- .../resources/rr-sjr/HooksWithJsFns-out3.js | 2 +- .../rr-sjr/HooksWithScalaFns-out2.js | 2 +- .../rr-sjr/HooksWithScalaFns-out3.js | 2 +- .../JustPropsChildrenViaHookApi-out2.js | 6 +- .../test/resources/rr-sjr/UseState-out2.js | 2 +- .../test/resources/rr-sjr/UseState-out3.js | 2 +- .../rr-sjr/UseStateWithReuse-out2.js | 21 +- .../rr-sjr/UseStateWithReuse-out3.js | 25 +- 18 files changed, 316 insertions(+), 360 deletions(-) diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/HookCtx.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/HookCtx.scala index 6b37cf974..4c9d176da 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/HookCtx.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/HookCtx.scala @@ -12,237 +12,238 @@ import japgolly.scalajs.react.{PropsChildren, Reusability} object HookCtx { - def apply[P, H1](props: P, hook1: H1): P1[P, H1] = + @inline def apply[P, H1](props: P, hook1: H1): P1[P, H1] = new P1(props, hook1) - def apply[P, H1, H2](props: P, hook1: H1, hook2: H2): P2[P, H1, H2] = + @inline def apply[P, H1, H2](props: P, hook1: H1, hook2: H2): P2[P, H1, H2] = new P2(props, hook1, hook2) - def apply[P, H1, H2, H3](props: P, hook1: H1, hook2: H2, hook3: H3): P3[P, H1, H2, H3] = + @inline def apply[P, H1, H2, H3](props: P, hook1: H1, hook2: H2, hook3: H3): P3[P, H1, H2, H3] = new P3(props, hook1, hook2, hook3) - def apply[P, H1, H2, H3, H4](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4): P4[P, H1, H2, H3, H4] = + @inline def apply[P, H1, H2, H3, H4](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4): P4[P, H1, H2, H3, H4] = new P4(props, hook1, hook2, hook3, hook4) - def apply[P, H1, H2, H3, H4, H5](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5): P5[P, H1, H2, H3, H4, H5] = + @inline def apply[P, H1, H2, H3, H4, H5](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5): P5[P, H1, H2, H3, H4, H5] = new P5(props, hook1, hook2, hook3, hook4, hook5) - def apply[P, H1, H2, H3, H4, H5, H6](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6): P6[P, H1, H2, H3, H4, H5, H6] = + @inline def apply[P, H1, H2, H3, H4, H5, H6](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6): P6[P, H1, H2, H3, H4, H5, H6] = new P6(props, hook1, hook2, hook3, hook4, hook5, hook6) - def apply[P, H1, H2, H3, H4, H5, H6, H7](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7): P7[P, H1, H2, H3, H4, H5, H6, H7] = + @inline def apply[P, H1, H2, H3, H4, H5, H6, H7](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7): P7[P, H1, H2, H3, H4, H5, H6, H7] = new P7(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7) - def apply[P, H1, H2, H3, H4, H5, H6, H7, H8](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8): P8[P, H1, H2, H3, H4, H5, H6, H7, H8] = + @inline def apply[P, H1, H2, H3, H4, H5, H6, H7, H8](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8): P8[P, H1, H2, H3, H4, H5, H6, H7, H8] = new P8(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8) - def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9): P9[P, H1, H2, H3, H4, H5, H6, H7, H8, H9] = + @inline def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9): P9[P, H1, H2, H3, H4, H5, H6, H7, H8, H9] = new P9(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9) - def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10): P10[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10] = + @inline def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10): P10[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10] = new P10(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10) - def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11): P11[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11] = + @inline def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11): P11[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11] = new P11(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11) - def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12): P12[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12] = + @inline def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12): P12[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12] = new P12(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12) - def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13): P13[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13] = + @inline def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13): P13[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13] = new P13(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13) - def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14): P14[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14] = + @inline def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14): P14[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14] = new P14(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14) - def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15): P15[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15] = + @inline def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15): P15[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15] = new P15(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15) - def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16): P16[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16] = + @inline def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16): P16[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16] = new P16(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16) - def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17): P17[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17] = + @inline def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17): P17[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17] = new P17(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17) - def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18): P18[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18] = + @inline def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18): P18[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18] = new P18(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18) - def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18, hook19: H19): P19[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19] = + @inline def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18, hook19: H19): P19[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19] = new P19(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19) - def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18, hook19: H19, hook20: H20): P20[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20] = + @inline def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18, hook19: H19, hook20: H20): P20[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20] = new P20(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19, hook20) - def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20, H21](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18, hook19: H19, hook20: H20, hook21: H21): P21[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20, H21] = + @inline def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20, H21](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18, hook19: H19, hook20: H20, hook21: H21): P21[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20, H21] = new P21(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19, hook20, hook21) - abstract class P0[+P](final val props: P) + + @inline abstract class P0[+P](final val props: P) implicit def reusabilityP0[P](implicit P: Reusability[P]): Reusability[P0[P]] = Reusability.by(_.props) - class P1[+P, +H1](props: P, final val hook1: H1) extends P0(props) { + @inline class P1[+P, +H1](props: P, final val hook1: H1) extends P0(props) { override def toString = s"HookCtx(\n props = $props,\n hook1 = $hook1)" - def apply1[A](f: (P, H1) => A): A = f(props, hook1) + @inline final def apply1[A](f: (P, H1) => A): A = f(props, hook1) } implicit def reusabilityP1[P, H1](implicit P: Reusability[P], H1: Reusability[H1]): Reusability[P1[P, H1]] = Reusability((x, y) => P.test(x.props, y.props) && H1.test(x.hook1, y.hook1)) - class P2[+P, +H1, +H2](props: P, hook1: H1, final val hook2: H2) extends P1(props, hook1) { + @inline class P2[+P, +H1, +H2](props: P, hook1: H1, final val hook2: H2) extends P1(props, hook1) { override def toString = s"HookCtx(\n props = $props,\n hook1 = $hook1,\n hook2 = $hook2)" - def apply2[A](f: (P, H1, H2) => A): A = f(props, hook1, hook2) + @inline final def apply2[A](f: (P, H1, H2) => A): A = f(props, hook1, hook2) } implicit def reusabilityP2[P, H1, H2](implicit P: Reusability[P], H1: Reusability[H1], H2: Reusability[H2]): Reusability[P2[P, H1, H2]] = Reusability((x, y) => P.test(x.props, y.props) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2)) - class P3[+P, +H1, +H2, +H3](props: P, hook1: H1, hook2: H2, final val hook3: H3) extends P2(props, hook1, hook2) { + @inline class P3[+P, +H1, +H2, +H3](props: P, hook1: H1, hook2: H2, final val hook3: H3) extends P2(props, hook1, hook2) { override def toString = s"HookCtx(\n props = $props,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3)" - def apply3[A](f: (P, H1, H2, H3) => A): A = f(props, hook1, hook2, hook3) + @inline final def apply3[A](f: (P, H1, H2, H3) => A): A = f(props, hook1, hook2, hook3) } implicit def reusabilityP3[P, H1, H2, H3](implicit P: Reusability[P], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3]): Reusability[P3[P, H1, H2, H3]] = Reusability((x, y) => P.test(x.props, y.props) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3)) - class P4[+P, +H1, +H2, +H3, +H4](props: P, hook1: H1, hook2: H2, hook3: H3, final val hook4: H4) extends P3(props, hook1, hook2, hook3) { + @inline class P4[+P, +H1, +H2, +H3, +H4](props: P, hook1: H1, hook2: H2, hook3: H3, final val hook4: H4) extends P3(props, hook1, hook2, hook3) { override def toString = s"HookCtx(\n props = $props,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4)" - def apply4[A](f: (P, H1, H2, H3, H4) => A): A = f(props, hook1, hook2, hook3, hook4) + @inline final def apply4[A](f: (P, H1, H2, H3, H4) => A): A = f(props, hook1, hook2, hook3, hook4) } implicit def reusabilityP4[P, H1, H2, H3, H4](implicit P: Reusability[P], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4]): Reusability[P4[P, H1, H2, H3, H4]] = Reusability((x, y) => P.test(x.props, y.props) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4)) - class P5[+P, +H1, +H2, +H3, +H4, +H5](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, final val hook5: H5) extends P4(props, hook1, hook2, hook3, hook4) { + @inline class P5[+P, +H1, +H2, +H3, +H4, +H5](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, final val hook5: H5) extends P4(props, hook1, hook2, hook3, hook4) { override def toString = s"HookCtx(\n props = $props,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5)" - def apply5[A](f: (P, H1, H2, H3, H4, H5) => A): A = f(props, hook1, hook2, hook3, hook4, hook5) + @inline final def apply5[A](f: (P, H1, H2, H3, H4, H5) => A): A = f(props, hook1, hook2, hook3, hook4, hook5) } implicit def reusabilityP5[P, H1, H2, H3, H4, H5](implicit P: Reusability[P], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5]): Reusability[P5[P, H1, H2, H3, H4, H5]] = Reusability((x, y) => P.test(x.props, y.props) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5)) - class P6[+P, +H1, +H2, +H3, +H4, +H5, +H6](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, final val hook6: H6) extends P5(props, hook1, hook2, hook3, hook4, hook5) { + @inline class P6[+P, +H1, +H2, +H3, +H4, +H5, +H6](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, final val hook6: H6) extends P5(props, hook1, hook2, hook3, hook4, hook5) { override def toString = s"HookCtx(\n props = $props,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6)" - def apply6[A](f: (P, H1, H2, H3, H4, H5, H6) => A): A = f(props, hook1, hook2, hook3, hook4, hook5, hook6) + @inline final def apply6[A](f: (P, H1, H2, H3, H4, H5, H6) => A): A = f(props, hook1, hook2, hook3, hook4, hook5, hook6) } implicit def reusabilityP6[P, H1, H2, H3, H4, H5, H6](implicit P: Reusability[P], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6]): Reusability[P6[P, H1, H2, H3, H4, H5, H6]] = Reusability((x, y) => P.test(x.props, y.props) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6)) - class P7[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, final val hook7: H7) extends P6(props, hook1, hook2, hook3, hook4, hook5, hook6) { + @inline class P7[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, final val hook7: H7) extends P6(props, hook1, hook2, hook3, hook4, hook5, hook6) { override def toString = s"HookCtx(\n props = $props,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7)" - def apply7[A](f: (P, H1, H2, H3, H4, H5, H6, H7) => A): A = f(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7) + @inline final def apply7[A](f: (P, H1, H2, H3, H4, H5, H6, H7) => A): A = f(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7) } implicit def reusabilityP7[P, H1, H2, H3, H4, H5, H6, H7](implicit P: Reusability[P], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7]): Reusability[P7[P, H1, H2, H3, H4, H5, H6, H7]] = Reusability((x, y) => P.test(x.props, y.props) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7)) - class P8[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, final val hook8: H8) extends P7(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7) { + @inline class P8[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, final val hook8: H8) extends P7(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7) { override def toString = s"HookCtx(\n props = $props,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8)" - def apply8[A](f: (P, H1, H2, H3, H4, H5, H6, H7, H8) => A): A = f(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8) + @inline final def apply8[A](f: (P, H1, H2, H3, H4, H5, H6, H7, H8) => A): A = f(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8) } implicit def reusabilityP8[P, H1, H2, H3, H4, H5, H6, H7, H8](implicit P: Reusability[P], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8]): Reusability[P8[P, H1, H2, H3, H4, H5, H6, H7, H8]] = Reusability((x, y) => P.test(x.props, y.props) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8)) - class P9[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, final val hook9: H9) extends P8(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8) { + @inline class P9[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, final val hook9: H9) extends P8(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8) { override def toString = s"HookCtx(\n props = $props,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9)" - def apply9[A](f: (P, H1, H2, H3, H4, H5, H6, H7, H8, H9) => A): A = f(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9) + @inline final def apply9[A](f: (P, H1, H2, H3, H4, H5, H6, H7, H8, H9) => A): A = f(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9) } implicit def reusabilityP9[P, H1, H2, H3, H4, H5, H6, H7, H8, H9](implicit P: Reusability[P], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9]): Reusability[P9[P, H1, H2, H3, H4, H5, H6, H7, H8, H9]] = Reusability((x, y) => P.test(x.props, y.props) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9)) - class P10[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, final val hook10: H10) extends P9(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9) { + @inline class P10[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, final val hook10: H10) extends P9(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9) { override def toString = s"HookCtx(\n props = $props,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10)" - def apply10[A](f: (P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10) => A): A = f(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10) + @inline final def apply10[A](f: (P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10) => A): A = f(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10) } implicit def reusabilityP10[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10](implicit P: Reusability[P], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10]): Reusability[P10[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10]] = Reusability((x, y) => P.test(x.props, y.props) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9) && H10.test(x.hook10, y.hook10)) - class P11[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, final val hook11: H11) extends P10(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10) { + @inline class P11[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, final val hook11: H11) extends P10(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10) { override def toString = s"HookCtx(\n props = $props,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10,\n hook11 = $hook11)" - def apply11[A](f: (P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11) => A): A = f(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11) + @inline final def apply11[A](f: (P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11) => A): A = f(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11) } implicit def reusabilityP11[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11](implicit P: Reusability[P], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10], H11: Reusability[H11]): Reusability[P11[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11]] = Reusability((x, y) => P.test(x.props, y.props) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9) && H10.test(x.hook10, y.hook10) && H11.test(x.hook11, y.hook11)) - class P12[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, final val hook12: H12) extends P11(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11) { + @inline class P12[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, final val hook12: H12) extends P11(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11) { override def toString = s"HookCtx(\n props = $props,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10,\n hook11 = $hook11,\n hook12 = $hook12)" - def apply12[A](f: (P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12) => A): A = f(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12) + @inline final def apply12[A](f: (P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12) => A): A = f(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12) } implicit def reusabilityP12[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12](implicit P: Reusability[P], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10], H11: Reusability[H11], H12: Reusability[H12]): Reusability[P12[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12]] = Reusability((x, y) => P.test(x.props, y.props) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9) && H10.test(x.hook10, y.hook10) && H11.test(x.hook11, y.hook11) && H12.test(x.hook12, y.hook12)) - class P13[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, final val hook13: H13) extends P12(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12) { + @inline class P13[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, final val hook13: H13) extends P12(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12) { override def toString = s"HookCtx(\n props = $props,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10,\n hook11 = $hook11,\n hook12 = $hook12,\n hook13 = $hook13)" - def apply13[A](f: (P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13) => A): A = f(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13) + @inline final def apply13[A](f: (P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13) => A): A = f(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13) } implicit def reusabilityP13[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13](implicit P: Reusability[P], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10], H11: Reusability[H11], H12: Reusability[H12], H13: Reusability[H13]): Reusability[P13[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13]] = Reusability((x, y) => P.test(x.props, y.props) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9) && H10.test(x.hook10, y.hook10) && H11.test(x.hook11, y.hook11) && H12.test(x.hook12, y.hook12) && H13.test(x.hook13, y.hook13)) - class P14[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, final val hook14: H14) extends P13(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13) { + @inline class P14[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, final val hook14: H14) extends P13(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13) { override def toString = s"HookCtx(\n props = $props,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10,\n hook11 = $hook11,\n hook12 = $hook12,\n hook13 = $hook13,\n hook14 = $hook14)" - def apply14[A](f: (P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14) => A): A = f(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14) + @inline final def apply14[A](f: (P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14) => A): A = f(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14) } implicit def reusabilityP14[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14](implicit P: Reusability[P], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10], H11: Reusability[H11], H12: Reusability[H12], H13: Reusability[H13], H14: Reusability[H14]): Reusability[P14[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14]] = Reusability((x, y) => P.test(x.props, y.props) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9) && H10.test(x.hook10, y.hook10) && H11.test(x.hook11, y.hook11) && H12.test(x.hook12, y.hook12) && H13.test(x.hook13, y.hook13) && H14.test(x.hook14, y.hook14)) - class P15[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, final val hook15: H15) extends P14(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14) { + @inline class P15[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, final val hook15: H15) extends P14(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14) { override def toString = s"HookCtx(\n props = $props,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10,\n hook11 = $hook11,\n hook12 = $hook12,\n hook13 = $hook13,\n hook14 = $hook14,\n hook15 = $hook15)" - def apply15[A](f: (P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15) => A): A = f(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15) + @inline final def apply15[A](f: (P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15) => A): A = f(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15) } implicit def reusabilityP15[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15](implicit P: Reusability[P], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10], H11: Reusability[H11], H12: Reusability[H12], H13: Reusability[H13], H14: Reusability[H14], H15: Reusability[H15]): Reusability[P15[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15]] = Reusability((x, y) => P.test(x.props, y.props) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9) && H10.test(x.hook10, y.hook10) && H11.test(x.hook11, y.hook11) && H12.test(x.hook12, y.hook12) && H13.test(x.hook13, y.hook13) && H14.test(x.hook14, y.hook14) && H15.test(x.hook15, y.hook15)) - class P16[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15, +H16](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, final val hook16: H16) extends P15(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15) { + @inline class P16[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15, +H16](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, final val hook16: H16) extends P15(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15) { override def toString = s"HookCtx(\n props = $props,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10,\n hook11 = $hook11,\n hook12 = $hook12,\n hook13 = $hook13,\n hook14 = $hook14,\n hook15 = $hook15,\n hook16 = $hook16)" - def apply16[A](f: (P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16) => A): A = f(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16) + @inline final def apply16[A](f: (P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16) => A): A = f(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16) } implicit def reusabilityP16[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16](implicit P: Reusability[P], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10], H11: Reusability[H11], H12: Reusability[H12], H13: Reusability[H13], H14: Reusability[H14], H15: Reusability[H15], H16: Reusability[H16]): Reusability[P16[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16]] = Reusability((x, y) => P.test(x.props, y.props) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9) && H10.test(x.hook10, y.hook10) && H11.test(x.hook11, y.hook11) && H12.test(x.hook12, y.hook12) && H13.test(x.hook13, y.hook13) && H14.test(x.hook14, y.hook14) && H15.test(x.hook15, y.hook15) && H16.test(x.hook16, y.hook16)) - class P17[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15, +H16, +H17](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, final val hook17: H17) extends P16(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16) { + @inline class P17[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15, +H16, +H17](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, final val hook17: H17) extends P16(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16) { override def toString = s"HookCtx(\n props = $props,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10,\n hook11 = $hook11,\n hook12 = $hook12,\n hook13 = $hook13,\n hook14 = $hook14,\n hook15 = $hook15,\n hook16 = $hook16,\n hook17 = $hook17)" - def apply17[A](f: (P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17) => A): A = f(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17) + @inline final def apply17[A](f: (P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17) => A): A = f(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17) } implicit def reusabilityP17[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17](implicit P: Reusability[P], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10], H11: Reusability[H11], H12: Reusability[H12], H13: Reusability[H13], H14: Reusability[H14], H15: Reusability[H15], H16: Reusability[H16], H17: Reusability[H17]): Reusability[P17[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17]] = Reusability((x, y) => P.test(x.props, y.props) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9) && H10.test(x.hook10, y.hook10) && H11.test(x.hook11, y.hook11) && H12.test(x.hook12, y.hook12) && H13.test(x.hook13, y.hook13) && H14.test(x.hook14, y.hook14) && H15.test(x.hook15, y.hook15) && H16.test(x.hook16, y.hook16) && H17.test(x.hook17, y.hook17)) - class P18[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15, +H16, +H17, +H18](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, final val hook18: H18) extends P17(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17) { + @inline class P18[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15, +H16, +H17, +H18](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, final val hook18: H18) extends P17(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17) { override def toString = s"HookCtx(\n props = $props,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10,\n hook11 = $hook11,\n hook12 = $hook12,\n hook13 = $hook13,\n hook14 = $hook14,\n hook15 = $hook15,\n hook16 = $hook16,\n hook17 = $hook17,\n hook18 = $hook18)" - def apply18[A](f: (P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18) => A): A = f(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18) + @inline final def apply18[A](f: (P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18) => A): A = f(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18) } implicit def reusabilityP18[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18](implicit P: Reusability[P], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10], H11: Reusability[H11], H12: Reusability[H12], H13: Reusability[H13], H14: Reusability[H14], H15: Reusability[H15], H16: Reusability[H16], H17: Reusability[H17], H18: Reusability[H18]): Reusability[P18[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18]] = Reusability((x, y) => P.test(x.props, y.props) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9) && H10.test(x.hook10, y.hook10) && H11.test(x.hook11, y.hook11) && H12.test(x.hook12, y.hook12) && H13.test(x.hook13, y.hook13) && H14.test(x.hook14, y.hook14) && H15.test(x.hook15, y.hook15) && H16.test(x.hook16, y.hook16) && H17.test(x.hook17, y.hook17) && H18.test(x.hook18, y.hook18)) - class P19[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15, +H16, +H17, +H18, +H19](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18, final val hook19: H19) extends P18(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18) { + @inline class P19[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15, +H16, +H17, +H18, +H19](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18, final val hook19: H19) extends P18(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18) { override def toString = s"HookCtx(\n props = $props,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10,\n hook11 = $hook11,\n hook12 = $hook12,\n hook13 = $hook13,\n hook14 = $hook14,\n hook15 = $hook15,\n hook16 = $hook16,\n hook17 = $hook17,\n hook18 = $hook18,\n hook19 = $hook19)" - def apply19[A](f: (P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19) => A): A = f(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19) + @inline final def apply19[A](f: (P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19) => A): A = f(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19) } implicit def reusabilityP19[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19](implicit P: Reusability[P], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10], H11: Reusability[H11], H12: Reusability[H12], H13: Reusability[H13], H14: Reusability[H14], H15: Reusability[H15], H16: Reusability[H16], H17: Reusability[H17], H18: Reusability[H18], H19: Reusability[H19]): Reusability[P19[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19]] = Reusability((x, y) => P.test(x.props, y.props) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9) && H10.test(x.hook10, y.hook10) && H11.test(x.hook11, y.hook11) && H12.test(x.hook12, y.hook12) && H13.test(x.hook13, y.hook13) && H14.test(x.hook14, y.hook14) && H15.test(x.hook15, y.hook15) && H16.test(x.hook16, y.hook16) && H17.test(x.hook17, y.hook17) && H18.test(x.hook18, y.hook18) && H19.test(x.hook19, y.hook19)) - class P20[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15, +H16, +H17, +H18, +H19, +H20](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18, hook19: H19, final val hook20: H20) extends P19(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19) { + @inline class P20[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15, +H16, +H17, +H18, +H19, +H20](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18, hook19: H19, final val hook20: H20) extends P19(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19) { override def toString = s"HookCtx(\n props = $props,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10,\n hook11 = $hook11,\n hook12 = $hook12,\n hook13 = $hook13,\n hook14 = $hook14,\n hook15 = $hook15,\n hook16 = $hook16,\n hook17 = $hook17,\n hook18 = $hook18,\n hook19 = $hook19,\n hook20 = $hook20)" - def apply20[A](f: (P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20) => A): A = f(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19, hook20) + @inline final def apply20[A](f: (P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20) => A): A = f(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19, hook20) } implicit def reusabilityP20[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20](implicit P: Reusability[P], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10], H11: Reusability[H11], H12: Reusability[H12], H13: Reusability[H13], H14: Reusability[H14], H15: Reusability[H15], H16: Reusability[H16], H17: Reusability[H17], H18: Reusability[H18], H19: Reusability[H19], H20: Reusability[H20]): Reusability[P20[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20]] = Reusability((x, y) => P.test(x.props, y.props) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9) && H10.test(x.hook10, y.hook10) && H11.test(x.hook11, y.hook11) && H12.test(x.hook12, y.hook12) && H13.test(x.hook13, y.hook13) && H14.test(x.hook14, y.hook14) && H15.test(x.hook15, y.hook15) && H16.test(x.hook16, y.hook16) && H17.test(x.hook17, y.hook17) && H18.test(x.hook18, y.hook18) && H19.test(x.hook19, y.hook19) && H20.test(x.hook20, y.hook20)) - class P21[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15, +H16, +H17, +H18, +H19, +H20, +H21](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18, hook19: H19, hook20: H20, final val hook21: H21) extends P20(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19, hook20) { + @inline class P21[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15, +H16, +H17, +H18, +H19, +H20, +H21](props: P, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18, hook19: H19, hook20: H20, final val hook21: H21) extends P20(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19, hook20) { override def toString = s"HookCtx(\n props = $props,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10,\n hook11 = $hook11,\n hook12 = $hook12,\n hook13 = $hook13,\n hook14 = $hook14,\n hook15 = $hook15,\n hook16 = $hook16,\n hook17 = $hook17,\n hook18 = $hook18,\n hook19 = $hook19,\n hook20 = $hook20,\n hook21 = $hook21)" - def apply21[A](f: (P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20, H21) => A): A = f(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19, hook20, hook21) + @inline final def apply21[A](f: (P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20, H21) => A): A = f(props, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19, hook20, hook21) } implicit def reusabilityP21[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20, H21](implicit P: Reusability[P], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10], H11: Reusability[H11], H12: Reusability[H12], H13: Reusability[H13], H14: Reusability[H14], H15: Reusability[H15], H16: Reusability[H16], H17: Reusability[H17], H18: Reusability[H18], H19: Reusability[H19], H20: Reusability[H20], H21: Reusability[H21]): Reusability[P21[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20, H21]] = @@ -252,230 +253,231 @@ object HookCtx { object withChildren { - def apply[P](props: P, propsChildren: PropsChildren): PC0[P] = + @inline def apply[P](props: P, propsChildren: PropsChildren): PC0[P] = new PC0(props, propsChildren) - def apply[P, H1](props: P, propsChildren: PropsChildren, hook1: H1): PC1[P, H1] = - new PC1(props, propsChildren, hook1) + @inline def apply[P, H1](props: P, propsChildren: PropsChildren, hook1: H1): PC1[P, H1] = + new PC1(props, propsChildren, hook1) + + @inline def apply[P, H1, H2](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2): PC2[P, H1, H2] = + new PC2(props, propsChildren, hook1, hook2) - def apply[P, H1, H2](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2): PC2[P, H1, H2] = - new PC2(props, propsChildren, hook1, hook2) + @inline def apply[P, H1, H2, H3](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3): PC3[P, H1, H2, H3] = + new PC3(props, propsChildren, hook1, hook2, hook3) - def apply[P, H1, H2, H3](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3): PC3[P, H1, H2, H3] = - new PC3(props, propsChildren, hook1, hook2, hook3) + @inline def apply[P, H1, H2, H3, H4](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4): PC4[P, H1, H2, H3, H4] = + new PC4(props, propsChildren, hook1, hook2, hook3, hook4) - def apply[P, H1, H2, H3, H4](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4): PC4[P, H1, H2, H3, H4] = - new PC4(props, propsChildren, hook1, hook2, hook3, hook4) + @inline def apply[P, H1, H2, H3, H4, H5](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5): PC5[P, H1, H2, H3, H4, H5] = + new PC5(props, propsChildren, hook1, hook2, hook3, hook4, hook5) - def apply[P, H1, H2, H3, H4, H5](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5): PC5[P, H1, H2, H3, H4, H5] = - new PC5(props, propsChildren, hook1, hook2, hook3, hook4, hook5) + @inline def apply[P, H1, H2, H3, H4, H5, H6](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6): PC6[P, H1, H2, H3, H4, H5, H6] = + new PC6(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6) - def apply[P, H1, H2, H3, H4, H5, H6](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6): PC6[P, H1, H2, H3, H4, H5, H6] = - new PC6(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6) + @inline def apply[P, H1, H2, H3, H4, H5, H6, H7](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7): PC7[P, H1, H2, H3, H4, H5, H6, H7] = + new PC7(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7) - def apply[P, H1, H2, H3, H4, H5, H6, H7](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7): PC7[P, H1, H2, H3, H4, H5, H6, H7] = - new PC7(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7) + @inline def apply[P, H1, H2, H3, H4, H5, H6, H7, H8](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8): PC8[P, H1, H2, H3, H4, H5, H6, H7, H8] = + new PC8(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8) - def apply[P, H1, H2, H3, H4, H5, H6, H7, H8](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8): PC8[P, H1, H2, H3, H4, H5, H6, H7, H8] = - new PC8(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8) + @inline def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9): PC9[P, H1, H2, H3, H4, H5, H6, H7, H8, H9] = + new PC9(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9) - def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9): PC9[P, H1, H2, H3, H4, H5, H6, H7, H8, H9] = - new PC9(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9) + @inline def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10): PC10[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10] = + new PC10(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10) - def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10): PC10[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10] = - new PC10(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10) + @inline def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11): PC11[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11] = + new PC11(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11) - def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11): PC11[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11] = - new PC11(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11) + @inline def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12): PC12[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12] = + new PC12(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12) - def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12): PC12[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12] = - new PC12(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12) + @inline def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13): PC13[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13] = + new PC13(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13) - def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13): PC13[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13] = - new PC13(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13) + @inline def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14): PC14[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14] = + new PC14(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14) - def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14): PC14[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14] = - new PC14(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14) + @inline def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15): PC15[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15] = + new PC15(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15) - def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15): PC15[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15] = - new PC15(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15) + @inline def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16): PC16[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16] = + new PC16(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16) - def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16): PC16[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16] = - new PC16(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16) + @inline def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17): PC17[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17] = + new PC17(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17) - def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17): PC17[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17] = - new PC17(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17) + @inline def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18): PC18[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18] = + new PC18(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18) - def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18): PC18[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18] = - new PC18(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18) + @inline def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18, hook19: H19): PC19[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19] = + new PC19(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19) - def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18, hook19: H19): PC19[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19] = - new PC19(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19) + @inline def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18, hook19: H19, hook20: H20): PC20[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20] = + new PC20(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19, hook20) - def apply[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18, hook19: H19, hook20: H20): PC20[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20] = - new PC20(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19, hook20) } - class PC0[+P](props: P, final val propsChildren: PropsChildren) extends P0(props) + @inline class PC0[+P](props: P, final val propsChildren: PropsChildren) extends P0(props) implicit def reusabilityPC0[P](implicit P: Reusability[P], PC: Reusability[PropsChildren]): Reusability[PC0[P]] = Reusability((x, y) => P.test(x.props, y.props) && PC.test(x.propsChildren, y.propsChildren)) - class PC1[+P, +H1](props: P, propsChildren: PropsChildren, final val hook1: H1) extends PC0(props, propsChildren) { + @inline class PC1[+P, +H1](props: P, propsChildren: PropsChildren, final val hook1: H1) extends PC0(props, propsChildren) { override def toString = s"HookCtx.withChildren(\n props = $props,\n propsChildren = $propsChildren,\n hook1 = $hook1)" - def apply1[A](f: (P, PropsChildren, H1) => A): A = f(props, propsChildren, hook1) + @inline final def apply1[A](f: (P, PropsChildren, H1) => A): A = f(props, propsChildren, hook1) } implicit def reusabilityPC1[P, H1](implicit P: Reusability[P], PC: Reusability[PropsChildren], H1: Reusability[H1]): Reusability[PC1[P, H1]] = Reusability((x, y) => P.test(x.props, y.props) && PC.test(x.propsChildren, y.propsChildren) && H1.test(x.hook1, y.hook1)) - class PC2[+P, +H1, +H2](props: P, propsChildren: PropsChildren, hook1: H1, final val hook2: H2) extends PC1(props, propsChildren, hook1) { + @inline class PC2[+P, +H1, +H2](props: P, propsChildren: PropsChildren, hook1: H1, final val hook2: H2) extends PC1(props, propsChildren, hook1) { override def toString = s"HookCtx.withChildren(\n props = $props,\n propsChildren = $propsChildren,\n hook1 = $hook1,\n hook2 = $hook2)" - def apply2[A](f: (P, PropsChildren, H1, H2) => A): A = f(props, propsChildren, hook1, hook2) + @inline final def apply2[A](f: (P, PropsChildren, H1, H2) => A): A = f(props, propsChildren, hook1, hook2) } implicit def reusabilityPC2[P, H1, H2](implicit P: Reusability[P], PC: Reusability[PropsChildren], H1: Reusability[H1], H2: Reusability[H2]): Reusability[PC2[P, H1, H2]] = Reusability((x, y) => P.test(x.props, y.props) && PC.test(x.propsChildren, y.propsChildren) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2)) - class PC3[+P, +H1, +H2, +H3](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, final val hook3: H3) extends PC2(props, propsChildren, hook1, hook2) { + @inline class PC3[+P, +H1, +H2, +H3](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, final val hook3: H3) extends PC2(props, propsChildren, hook1, hook2) { override def toString = s"HookCtx.withChildren(\n props = $props,\n propsChildren = $propsChildren,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3)" - def apply3[A](f: (P, PropsChildren, H1, H2, H3) => A): A = f(props, propsChildren, hook1, hook2, hook3) + @inline final def apply3[A](f: (P, PropsChildren, H1, H2, H3) => A): A = f(props, propsChildren, hook1, hook2, hook3) } implicit def reusabilityPC3[P, H1, H2, H3](implicit P: Reusability[P], PC: Reusability[PropsChildren], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3]): Reusability[PC3[P, H1, H2, H3]] = Reusability((x, y) => P.test(x.props, y.props) && PC.test(x.propsChildren, y.propsChildren) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3)) - class PC4[+P, +H1, +H2, +H3, +H4](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, final val hook4: H4) extends PC3(props, propsChildren, hook1, hook2, hook3) { + @inline class PC4[+P, +H1, +H2, +H3, +H4](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, final val hook4: H4) extends PC3(props, propsChildren, hook1, hook2, hook3) { override def toString = s"HookCtx.withChildren(\n props = $props,\n propsChildren = $propsChildren,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4)" - def apply4[A](f: (P, PropsChildren, H1, H2, H3, H4) => A): A = f(props, propsChildren, hook1, hook2, hook3, hook4) + @inline final def apply4[A](f: (P, PropsChildren, H1, H2, H3, H4) => A): A = f(props, propsChildren, hook1, hook2, hook3, hook4) } implicit def reusabilityPC4[P, H1, H2, H3, H4](implicit P: Reusability[P], PC: Reusability[PropsChildren], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4]): Reusability[PC4[P, H1, H2, H3, H4]] = Reusability((x, y) => P.test(x.props, y.props) && PC.test(x.propsChildren, y.propsChildren) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4)) - class PC5[+P, +H1, +H2, +H3, +H4, +H5](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, final val hook5: H5) extends PC4(props, propsChildren, hook1, hook2, hook3, hook4) { + @inline class PC5[+P, +H1, +H2, +H3, +H4, +H5](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, final val hook5: H5) extends PC4(props, propsChildren, hook1, hook2, hook3, hook4) { override def toString = s"HookCtx.withChildren(\n props = $props,\n propsChildren = $propsChildren,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5)" - def apply5[A](f: (P, PropsChildren, H1, H2, H3, H4, H5) => A): A = f(props, propsChildren, hook1, hook2, hook3, hook4, hook5) + @inline final def apply5[A](f: (P, PropsChildren, H1, H2, H3, H4, H5) => A): A = f(props, propsChildren, hook1, hook2, hook3, hook4, hook5) } implicit def reusabilityPC5[P, H1, H2, H3, H4, H5](implicit P: Reusability[P], PC: Reusability[PropsChildren], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5]): Reusability[PC5[P, H1, H2, H3, H4, H5]] = Reusability((x, y) => P.test(x.props, y.props) && PC.test(x.propsChildren, y.propsChildren) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5)) - class PC6[+P, +H1, +H2, +H3, +H4, +H5, +H6](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, final val hook6: H6) extends PC5(props, propsChildren, hook1, hook2, hook3, hook4, hook5) { + @inline class PC6[+P, +H1, +H2, +H3, +H4, +H5, +H6](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, final val hook6: H6) extends PC5(props, propsChildren, hook1, hook2, hook3, hook4, hook5) { override def toString = s"HookCtx.withChildren(\n props = $props,\n propsChildren = $propsChildren,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6)" - def apply6[A](f: (P, PropsChildren, H1, H2, H3, H4, H5, H6) => A): A = f(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6) + @inline final def apply6[A](f: (P, PropsChildren, H1, H2, H3, H4, H5, H6) => A): A = f(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6) } implicit def reusabilityPC6[P, H1, H2, H3, H4, H5, H6](implicit P: Reusability[P], PC: Reusability[PropsChildren], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6]): Reusability[PC6[P, H1, H2, H3, H4, H5, H6]] = Reusability((x, y) => P.test(x.props, y.props) && PC.test(x.propsChildren, y.propsChildren) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6)) - class PC7[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, final val hook7: H7) extends PC6(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6) { + @inline class PC7[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, final val hook7: H7) extends PC6(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6) { override def toString = s"HookCtx.withChildren(\n props = $props,\n propsChildren = $propsChildren,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7)" - def apply7[A](f: (P, PropsChildren, H1, H2, H3, H4, H5, H6, H7) => A): A = f(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7) + @inline final def apply7[A](f: (P, PropsChildren, H1, H2, H3, H4, H5, H6, H7) => A): A = f(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7) } implicit def reusabilityPC7[P, H1, H2, H3, H4, H5, H6, H7](implicit P: Reusability[P], PC: Reusability[PropsChildren], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7]): Reusability[PC7[P, H1, H2, H3, H4, H5, H6, H7]] = Reusability((x, y) => P.test(x.props, y.props) && PC.test(x.propsChildren, y.propsChildren) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7)) - class PC8[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, final val hook8: H8) extends PC7(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7) { + @inline class PC8[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, final val hook8: H8) extends PC7(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7) { override def toString = s"HookCtx.withChildren(\n props = $props,\n propsChildren = $propsChildren,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8)" - def apply8[A](f: (P, PropsChildren, H1, H2, H3, H4, H5, H6, H7, H8) => A): A = f(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8) + @inline final def apply8[A](f: (P, PropsChildren, H1, H2, H3, H4, H5, H6, H7, H8) => A): A = f(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8) } implicit def reusabilityPC8[P, H1, H2, H3, H4, H5, H6, H7, H8](implicit P: Reusability[P], PC: Reusability[PropsChildren], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8]): Reusability[PC8[P, H1, H2, H3, H4, H5, H6, H7, H8]] = Reusability((x, y) => P.test(x.props, y.props) && PC.test(x.propsChildren, y.propsChildren) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8)) - class PC9[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, final val hook9: H9) extends PC8(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8) { + @inline class PC9[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, final val hook9: H9) extends PC8(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8) { override def toString = s"HookCtx.withChildren(\n props = $props,\n propsChildren = $propsChildren,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9)" - def apply9[A](f: (P, PropsChildren, H1, H2, H3, H4, H5, H6, H7, H8, H9) => A): A = f(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9) + @inline final def apply9[A](f: (P, PropsChildren, H1, H2, H3, H4, H5, H6, H7, H8, H9) => A): A = f(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9) } implicit def reusabilityPC9[P, H1, H2, H3, H4, H5, H6, H7, H8, H9](implicit P: Reusability[P], PC: Reusability[PropsChildren], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9]): Reusability[PC9[P, H1, H2, H3, H4, H5, H6, H7, H8, H9]] = Reusability((x, y) => P.test(x.props, y.props) && PC.test(x.propsChildren, y.propsChildren) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9)) - class PC10[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, final val hook10: H10) extends PC9(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9) { + @inline class PC10[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, final val hook10: H10) extends PC9(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9) { override def toString = s"HookCtx.withChildren(\n props = $props,\n propsChildren = $propsChildren,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10)" - def apply10[A](f: (P, PropsChildren, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10) => A): A = f(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10) + @inline final def apply10[A](f: (P, PropsChildren, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10) => A): A = f(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10) } implicit def reusabilityPC10[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10](implicit P: Reusability[P], PC: Reusability[PropsChildren], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10]): Reusability[PC10[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10]] = Reusability((x, y) => P.test(x.props, y.props) && PC.test(x.propsChildren, y.propsChildren) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9) && H10.test(x.hook10, y.hook10)) - class PC11[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, final val hook11: H11) extends PC10(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10) { + @inline class PC11[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, final val hook11: H11) extends PC10(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10) { override def toString = s"HookCtx.withChildren(\n props = $props,\n propsChildren = $propsChildren,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10,\n hook11 = $hook11)" - def apply11[A](f: (P, PropsChildren, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11) => A): A = f(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11) + @inline final def apply11[A](f: (P, PropsChildren, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11) => A): A = f(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11) } implicit def reusabilityPC11[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11](implicit P: Reusability[P], PC: Reusability[PropsChildren], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10], H11: Reusability[H11]): Reusability[PC11[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11]] = Reusability((x, y) => P.test(x.props, y.props) && PC.test(x.propsChildren, y.propsChildren) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9) && H10.test(x.hook10, y.hook10) && H11.test(x.hook11, y.hook11)) - class PC12[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, final val hook12: H12) extends PC11(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11) { + @inline class PC12[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, final val hook12: H12) extends PC11(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11) { override def toString = s"HookCtx.withChildren(\n props = $props,\n propsChildren = $propsChildren,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10,\n hook11 = $hook11,\n hook12 = $hook12)" - def apply12[A](f: (P, PropsChildren, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12) => A): A = f(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12) + @inline final def apply12[A](f: (P, PropsChildren, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12) => A): A = f(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12) } implicit def reusabilityPC12[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12](implicit P: Reusability[P], PC: Reusability[PropsChildren], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10], H11: Reusability[H11], H12: Reusability[H12]): Reusability[PC12[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12]] = Reusability((x, y) => P.test(x.props, y.props) && PC.test(x.propsChildren, y.propsChildren) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9) && H10.test(x.hook10, y.hook10) && H11.test(x.hook11, y.hook11) && H12.test(x.hook12, y.hook12)) - class PC13[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, final val hook13: H13) extends PC12(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12) { + @inline class PC13[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, final val hook13: H13) extends PC12(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12) { override def toString = s"HookCtx.withChildren(\n props = $props,\n propsChildren = $propsChildren,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10,\n hook11 = $hook11,\n hook12 = $hook12,\n hook13 = $hook13)" - def apply13[A](f: (P, PropsChildren, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13) => A): A = f(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13) + @inline final def apply13[A](f: (P, PropsChildren, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13) => A): A = f(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13) } implicit def reusabilityPC13[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13](implicit P: Reusability[P], PC: Reusability[PropsChildren], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10], H11: Reusability[H11], H12: Reusability[H12], H13: Reusability[H13]): Reusability[PC13[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13]] = Reusability((x, y) => P.test(x.props, y.props) && PC.test(x.propsChildren, y.propsChildren) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9) && H10.test(x.hook10, y.hook10) && H11.test(x.hook11, y.hook11) && H12.test(x.hook12, y.hook12) && H13.test(x.hook13, y.hook13)) - class PC14[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, final val hook14: H14) extends PC13(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13) { + @inline class PC14[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, final val hook14: H14) extends PC13(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13) { override def toString = s"HookCtx.withChildren(\n props = $props,\n propsChildren = $propsChildren,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10,\n hook11 = $hook11,\n hook12 = $hook12,\n hook13 = $hook13,\n hook14 = $hook14)" - def apply14[A](f: (P, PropsChildren, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14) => A): A = f(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14) + @inline final def apply14[A](f: (P, PropsChildren, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14) => A): A = f(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14) } implicit def reusabilityPC14[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14](implicit P: Reusability[P], PC: Reusability[PropsChildren], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10], H11: Reusability[H11], H12: Reusability[H12], H13: Reusability[H13], H14: Reusability[H14]): Reusability[PC14[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14]] = Reusability((x, y) => P.test(x.props, y.props) && PC.test(x.propsChildren, y.propsChildren) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9) && H10.test(x.hook10, y.hook10) && H11.test(x.hook11, y.hook11) && H12.test(x.hook12, y.hook12) && H13.test(x.hook13, y.hook13) && H14.test(x.hook14, y.hook14)) - class PC15[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, final val hook15: H15) extends PC14(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14) { + @inline class PC15[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, final val hook15: H15) extends PC14(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14) { override def toString = s"HookCtx.withChildren(\n props = $props,\n propsChildren = $propsChildren,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10,\n hook11 = $hook11,\n hook12 = $hook12,\n hook13 = $hook13,\n hook14 = $hook14,\n hook15 = $hook15)" - def apply15[A](f: (P, PropsChildren, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15) => A): A = f(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15) + @inline final def apply15[A](f: (P, PropsChildren, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15) => A): A = f(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15) } implicit def reusabilityPC15[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15](implicit P: Reusability[P], PC: Reusability[PropsChildren], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10], H11: Reusability[H11], H12: Reusability[H12], H13: Reusability[H13], H14: Reusability[H14], H15: Reusability[H15]): Reusability[PC15[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15]] = Reusability((x, y) => P.test(x.props, y.props) && PC.test(x.propsChildren, y.propsChildren) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9) && H10.test(x.hook10, y.hook10) && H11.test(x.hook11, y.hook11) && H12.test(x.hook12, y.hook12) && H13.test(x.hook13, y.hook13) && H14.test(x.hook14, y.hook14) && H15.test(x.hook15, y.hook15)) - class PC16[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15, +H16](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, final val hook16: H16) extends PC15(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15) { + @inline class PC16[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15, +H16](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, final val hook16: H16) extends PC15(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15) { override def toString = s"HookCtx.withChildren(\n props = $props,\n propsChildren = $propsChildren,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10,\n hook11 = $hook11,\n hook12 = $hook12,\n hook13 = $hook13,\n hook14 = $hook14,\n hook15 = $hook15,\n hook16 = $hook16)" - def apply16[A](f: (P, PropsChildren, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16) => A): A = f(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16) + @inline final def apply16[A](f: (P, PropsChildren, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16) => A): A = f(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16) } implicit def reusabilityPC16[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16](implicit P: Reusability[P], PC: Reusability[PropsChildren], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10], H11: Reusability[H11], H12: Reusability[H12], H13: Reusability[H13], H14: Reusability[H14], H15: Reusability[H15], H16: Reusability[H16]): Reusability[PC16[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16]] = Reusability((x, y) => P.test(x.props, y.props) && PC.test(x.propsChildren, y.propsChildren) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9) && H10.test(x.hook10, y.hook10) && H11.test(x.hook11, y.hook11) && H12.test(x.hook12, y.hook12) && H13.test(x.hook13, y.hook13) && H14.test(x.hook14, y.hook14) && H15.test(x.hook15, y.hook15) && H16.test(x.hook16, y.hook16)) - class PC17[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15, +H16, +H17](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, final val hook17: H17) extends PC16(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16) { + @inline class PC17[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15, +H16, +H17](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, final val hook17: H17) extends PC16(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16) { override def toString = s"HookCtx.withChildren(\n props = $props,\n propsChildren = $propsChildren,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10,\n hook11 = $hook11,\n hook12 = $hook12,\n hook13 = $hook13,\n hook14 = $hook14,\n hook15 = $hook15,\n hook16 = $hook16,\n hook17 = $hook17)" - def apply17[A](f: (P, PropsChildren, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17) => A): A = f(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17) + @inline final def apply17[A](f: (P, PropsChildren, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17) => A): A = f(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17) } implicit def reusabilityPC17[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17](implicit P: Reusability[P], PC: Reusability[PropsChildren], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10], H11: Reusability[H11], H12: Reusability[H12], H13: Reusability[H13], H14: Reusability[H14], H15: Reusability[H15], H16: Reusability[H16], H17: Reusability[H17]): Reusability[PC17[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17]] = Reusability((x, y) => P.test(x.props, y.props) && PC.test(x.propsChildren, y.propsChildren) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9) && H10.test(x.hook10, y.hook10) && H11.test(x.hook11, y.hook11) && H12.test(x.hook12, y.hook12) && H13.test(x.hook13, y.hook13) && H14.test(x.hook14, y.hook14) && H15.test(x.hook15, y.hook15) && H16.test(x.hook16, y.hook16) && H17.test(x.hook17, y.hook17)) - class PC18[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15, +H16, +H17, +H18](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, final val hook18: H18) extends PC17(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17) { + @inline class PC18[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15, +H16, +H17, +H18](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, final val hook18: H18) extends PC17(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17) { override def toString = s"HookCtx.withChildren(\n props = $props,\n propsChildren = $propsChildren,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10,\n hook11 = $hook11,\n hook12 = $hook12,\n hook13 = $hook13,\n hook14 = $hook14,\n hook15 = $hook15,\n hook16 = $hook16,\n hook17 = $hook17,\n hook18 = $hook18)" - def apply18[A](f: (P, PropsChildren, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18) => A): A = f(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18) + @inline final def apply18[A](f: (P, PropsChildren, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18) => A): A = f(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18) } implicit def reusabilityPC18[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18](implicit P: Reusability[P], PC: Reusability[PropsChildren], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10], H11: Reusability[H11], H12: Reusability[H12], H13: Reusability[H13], H14: Reusability[H14], H15: Reusability[H15], H16: Reusability[H16], H17: Reusability[H17], H18: Reusability[H18]): Reusability[PC18[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18]] = Reusability((x, y) => P.test(x.props, y.props) && PC.test(x.propsChildren, y.propsChildren) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9) && H10.test(x.hook10, y.hook10) && H11.test(x.hook11, y.hook11) && H12.test(x.hook12, y.hook12) && H13.test(x.hook13, y.hook13) && H14.test(x.hook14, y.hook14) && H15.test(x.hook15, y.hook15) && H16.test(x.hook16, y.hook16) && H17.test(x.hook17, y.hook17) && H18.test(x.hook18, y.hook18)) - class PC19[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15, +H16, +H17, +H18, +H19](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18, final val hook19: H19) extends PC18(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18) { + @inline class PC19[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15, +H16, +H17, +H18, +H19](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18, final val hook19: H19) extends PC18(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18) { override def toString = s"HookCtx.withChildren(\n props = $props,\n propsChildren = $propsChildren,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10,\n hook11 = $hook11,\n hook12 = $hook12,\n hook13 = $hook13,\n hook14 = $hook14,\n hook15 = $hook15,\n hook16 = $hook16,\n hook17 = $hook17,\n hook18 = $hook18,\n hook19 = $hook19)" - def apply19[A](f: (P, PropsChildren, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19) => A): A = f(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19) + @inline final def apply19[A](f: (P, PropsChildren, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19) => A): A = f(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19) } implicit def reusabilityPC19[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19](implicit P: Reusability[P], PC: Reusability[PropsChildren], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10], H11: Reusability[H11], H12: Reusability[H12], H13: Reusability[H13], H14: Reusability[H14], H15: Reusability[H15], H16: Reusability[H16], H17: Reusability[H17], H18: Reusability[H18], H19: Reusability[H19]): Reusability[PC19[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19]] = Reusability((x, y) => P.test(x.props, y.props) && PC.test(x.propsChildren, y.propsChildren) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9) && H10.test(x.hook10, y.hook10) && H11.test(x.hook11, y.hook11) && H12.test(x.hook12, y.hook12) && H13.test(x.hook13, y.hook13) && H14.test(x.hook14, y.hook14) && H15.test(x.hook15, y.hook15) && H16.test(x.hook16, y.hook16) && H17.test(x.hook17, y.hook17) && H18.test(x.hook18, y.hook18) && H19.test(x.hook19, y.hook19)) - class PC20[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15, +H16, +H17, +H18, +H19, +H20](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18, hook19: H19, final val hook20: H20) extends PC19(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19) { + @inline class PC20[+P, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15, +H16, +H17, +H18, +H19, +H20](props: P, propsChildren: PropsChildren, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18, hook19: H19, final val hook20: H20) extends PC19(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19) { override def toString = s"HookCtx.withChildren(\n props = $props,\n propsChildren = $propsChildren,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10,\n hook11 = $hook11,\n hook12 = $hook12,\n hook13 = $hook13,\n hook14 = $hook14,\n hook15 = $hook15,\n hook16 = $hook16,\n hook17 = $hook17,\n hook18 = $hook18,\n hook19 = $hook19,\n hook20 = $hook20)" - def apply20[A](f: (P, PropsChildren, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20) => A): A = f(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19, hook20) + @inline final def apply20[A](f: (P, PropsChildren, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20) => A): A = f(props, propsChildren, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19, hook20) } implicit def reusabilityPC20[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20](implicit P: Reusability[P], PC: Reusability[PropsChildren], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10], H11: Reusability[H11], H12: Reusability[H12], H13: Reusability[H13], H14: Reusability[H14], H15: Reusability[H15], H16: Reusability[H16], H17: Reusability[H17], H18: Reusability[H18], H19: Reusability[H19], H20: Reusability[H20]): Reusability[PC20[P, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20]] = @@ -486,241 +488,242 @@ object HookCtx { object withInput { - def apply[I](input: I): I0[I] = + @inline def apply[I](input: I): I0[I] = new I0(input) - def apply[I, H1](input: I, hook1: H1): I1[I, H1] = + @inline def apply[I, H1](input: I, hook1: H1): I1[I, H1] = new I1(input, hook1) - def apply[I, H1, H2](input: I, hook1: H1, hook2: H2): I2[I, H1, H2] = + @inline def apply[I, H1, H2](input: I, hook1: H1, hook2: H2): I2[I, H1, H2] = new I2(input, hook1, hook2) - def apply[I, H1, H2, H3](input: I, hook1: H1, hook2: H2, hook3: H3): I3[I, H1, H2, H3] = + @inline def apply[I, H1, H2, H3](input: I, hook1: H1, hook2: H2, hook3: H3): I3[I, H1, H2, H3] = new I3(input, hook1, hook2, hook3) - def apply[I, H1, H2, H3, H4](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4): I4[I, H1, H2, H3, H4] = + @inline def apply[I, H1, H2, H3, H4](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4): I4[I, H1, H2, H3, H4] = new I4(input, hook1, hook2, hook3, hook4) - def apply[I, H1, H2, H3, H4, H5](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5): I5[I, H1, H2, H3, H4, H5] = + @inline def apply[I, H1, H2, H3, H4, H5](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5): I5[I, H1, H2, H3, H4, H5] = new I5(input, hook1, hook2, hook3, hook4, hook5) - def apply[I, H1, H2, H3, H4, H5, H6](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6): I6[I, H1, H2, H3, H4, H5, H6] = + @inline def apply[I, H1, H2, H3, H4, H5, H6](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6): I6[I, H1, H2, H3, H4, H5, H6] = new I6(input, hook1, hook2, hook3, hook4, hook5, hook6) - def apply[I, H1, H2, H3, H4, H5, H6, H7](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7): I7[I, H1, H2, H3, H4, H5, H6, H7] = + @inline def apply[I, H1, H2, H3, H4, H5, H6, H7](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7): I7[I, H1, H2, H3, H4, H5, H6, H7] = new I7(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7) - def apply[I, H1, H2, H3, H4, H5, H6, H7, H8](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8): I8[I, H1, H2, H3, H4, H5, H6, H7, H8] = + @inline def apply[I, H1, H2, H3, H4, H5, H6, H7, H8](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8): I8[I, H1, H2, H3, H4, H5, H6, H7, H8] = new I8(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8) - def apply[I, H1, H2, H3, H4, H5, H6, H7, H8, H9](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9): I9[I, H1, H2, H3, H4, H5, H6, H7, H8, H9] = + @inline def apply[I, H1, H2, H3, H4, H5, H6, H7, H8, H9](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9): I9[I, H1, H2, H3, H4, H5, H6, H7, H8, H9] = new I9(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9) - def apply[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10): I10[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10] = + @inline def apply[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10): I10[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10] = new I10(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10) - def apply[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11): I11[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11] = + @inline def apply[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11): I11[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11] = new I11(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11) - def apply[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12): I12[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12] = + @inline def apply[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12): I12[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12] = new I12(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12) - def apply[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13): I13[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13] = + @inline def apply[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13): I13[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13] = new I13(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13) - def apply[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14): I14[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14] = + @inline def apply[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14): I14[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14] = new I14(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14) - def apply[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15): I15[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15] = + @inline def apply[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15): I15[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15] = new I15(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15) - def apply[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16): I16[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16] = + @inline def apply[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16): I16[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16] = new I16(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16) - def apply[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17): I17[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17] = + @inline def apply[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17): I17[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17] = new I17(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17) - def apply[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18): I18[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18] = + @inline def apply[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18): I18[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18] = new I18(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18) - def apply[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18, hook19: H19): I19[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19] = + @inline def apply[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18, hook19: H19): I19[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19] = new I19(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19) - def apply[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18, hook19: H19, hook20: H20): I20[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20] = + @inline def apply[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18, hook19: H19, hook20: H20): I20[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20] = new I20(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19, hook20) - def apply[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20, H21](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18, hook19: H19, hook20: H20, hook21: H21): I21[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20, H21] = + @inline def apply[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20, H21](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18, hook19: H19, hook20: H20, hook21: H21): I21[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20, H21] = new I21(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19, hook20, hook21) + } - class I0[+I](final val input: I) + @inline class I0[+I](final val input: I) implicit def reusabilityI0[I](implicit I: Reusability[I]): Reusability[I0[I]] = Reusability.by(_.input) - class I1[+I, +H1](input: I, final val hook1: H1) extends I0(input) { + @inline class I1[+I, +H1](input: I, final val hook1: H1) extends I0(input) { override def toString = s"HookCtx.withInput(\n input = $input,\n hook1 = $hook1)" - def apply1[A](f: (I, H1) => A): A = f(input, hook1) + @inline final def apply1[A](f: (I, H1) => A): A = f(input, hook1) } implicit def reusabilityI1[I, H1](implicit I: Reusability[I], H1: Reusability[H1]): Reusability[I1[I, H1]] = Reusability((x, y) => I.test(x.input, y.input) && H1.test(x.hook1, y.hook1)) - class I2[+I, +H1, +H2](input: I, hook1: H1, final val hook2: H2) extends I1(input, hook1) { + @inline class I2[+I, +H1, +H2](input: I, hook1: H1, final val hook2: H2) extends I1(input, hook1) { override def toString = s"HookCtx.withInput(\n input = $input,\n hook1 = $hook1,\n hook2 = $hook2)" - def apply2[A](f: (I, H1, H2) => A): A = f(input, hook1, hook2) + @inline final def apply2[A](f: (I, H1, H2) => A): A = f(input, hook1, hook2) } implicit def reusabilityI2[I, H1, H2](implicit I: Reusability[I], H1: Reusability[H1], H2: Reusability[H2]): Reusability[I2[I, H1, H2]] = Reusability((x, y) => I.test(x.input, y.input) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2)) - class I3[+I, +H1, +H2, +H3](input: I, hook1: H1, hook2: H2, final val hook3: H3) extends I2(input, hook1, hook2) { + @inline class I3[+I, +H1, +H2, +H3](input: I, hook1: H1, hook2: H2, final val hook3: H3) extends I2(input, hook1, hook2) { override def toString = s"HookCtx.withInput(\n input = $input,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3)" - def apply3[A](f: (I, H1, H2, H3) => A): A = f(input, hook1, hook2, hook3) + @inline final def apply3[A](f: (I, H1, H2, H3) => A): A = f(input, hook1, hook2, hook3) } implicit def reusabilityI3[I, H1, H2, H3](implicit I: Reusability[I], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3]): Reusability[I3[I, H1, H2, H3]] = Reusability((x, y) => I.test(x.input, y.input) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3)) - class I4[+I, +H1, +H2, +H3, +H4](input: I, hook1: H1, hook2: H2, hook3: H3, final val hook4: H4) extends I3(input, hook1, hook2, hook3) { + @inline class I4[+I, +H1, +H2, +H3, +H4](input: I, hook1: H1, hook2: H2, hook3: H3, final val hook4: H4) extends I3(input, hook1, hook2, hook3) { override def toString = s"HookCtx.withInput(\n input = $input,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4)" - def apply4[A](f: (I, H1, H2, H3, H4) => A): A = f(input, hook1, hook2, hook3, hook4) + @inline final def apply4[A](f: (I, H1, H2, H3, H4) => A): A = f(input, hook1, hook2, hook3, hook4) } implicit def reusabilityI4[I, H1, H2, H3, H4](implicit I: Reusability[I], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4]): Reusability[I4[I, H1, H2, H3, H4]] = Reusability((x, y) => I.test(x.input, y.input) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4)) - class I5[+I, +H1, +H2, +H3, +H4, +H5](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, final val hook5: H5) extends I4(input, hook1, hook2, hook3, hook4) { + @inline class I5[+I, +H1, +H2, +H3, +H4, +H5](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, final val hook5: H5) extends I4(input, hook1, hook2, hook3, hook4) { override def toString = s"HookCtx.withInput(\n input = $input,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5)" - def apply5[A](f: (I, H1, H2, H3, H4, H5) => A): A = f(input, hook1, hook2, hook3, hook4, hook5) + @inline final def apply5[A](f: (I, H1, H2, H3, H4, H5) => A): A = f(input, hook1, hook2, hook3, hook4, hook5) } implicit def reusabilityI5[I, H1, H2, H3, H4, H5](implicit I: Reusability[I], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5]): Reusability[I5[I, H1, H2, H3, H4, H5]] = Reusability((x, y) => I.test(x.input, y.input) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5)) - class I6[+I, +H1, +H2, +H3, +H4, +H5, +H6](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, final val hook6: H6) extends I5(input, hook1, hook2, hook3, hook4, hook5) { + @inline class I6[+I, +H1, +H2, +H3, +H4, +H5, +H6](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, final val hook6: H6) extends I5(input, hook1, hook2, hook3, hook4, hook5) { override def toString = s"HookCtx.withInput(\n input = $input,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6)" - def apply6[A](f: (I, H1, H2, H3, H4, H5, H6) => A): A = f(input, hook1, hook2, hook3, hook4, hook5, hook6) + @inline final def apply6[A](f: (I, H1, H2, H3, H4, H5, H6) => A): A = f(input, hook1, hook2, hook3, hook4, hook5, hook6) } implicit def reusabilityI6[I, H1, H2, H3, H4, H5, H6](implicit I: Reusability[I], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6]): Reusability[I6[I, H1, H2, H3, H4, H5, H6]] = Reusability((x, y) => I.test(x.input, y.input) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6)) - class I7[+I, +H1, +H2, +H3, +H4, +H5, +H6, +H7](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, final val hook7: H7) extends I6(input, hook1, hook2, hook3, hook4, hook5, hook6) { + @inline class I7[+I, +H1, +H2, +H3, +H4, +H5, +H6, +H7](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, final val hook7: H7) extends I6(input, hook1, hook2, hook3, hook4, hook5, hook6) { override def toString = s"HookCtx.withInput(\n input = $input,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7)" - def apply7[A](f: (I, H1, H2, H3, H4, H5, H6, H7) => A): A = f(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7) + @inline final def apply7[A](f: (I, H1, H2, H3, H4, H5, H6, H7) => A): A = f(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7) } implicit def reusabilityI7[I, H1, H2, H3, H4, H5, H6, H7](implicit I: Reusability[I], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7]): Reusability[I7[I, H1, H2, H3, H4, H5, H6, H7]] = Reusability((x, y) => I.test(x.input, y.input) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7)) - class I8[+I, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, final val hook8: H8) extends I7(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7) { + @inline class I8[+I, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, final val hook8: H8) extends I7(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7) { override def toString = s"HookCtx.withInput(\n input = $input,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8)" - def apply8[A](f: (I, H1, H2, H3, H4, H5, H6, H7, H8) => A): A = f(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8) + @inline final def apply8[A](f: (I, H1, H2, H3, H4, H5, H6, H7, H8) => A): A = f(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8) } implicit def reusabilityI8[I, H1, H2, H3, H4, H5, H6, H7, H8](implicit I: Reusability[I], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8]): Reusability[I8[I, H1, H2, H3, H4, H5, H6, H7, H8]] = Reusability((x, y) => I.test(x.input, y.input) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8)) - class I9[+I, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, final val hook9: H9) extends I8(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8) { + @inline class I9[+I, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, final val hook9: H9) extends I8(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8) { override def toString = s"HookCtx.withInput(\n input = $input,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9)" - def apply9[A](f: (I, H1, H2, H3, H4, H5, H6, H7, H8, H9) => A): A = f(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9) + @inline final def apply9[A](f: (I, H1, H2, H3, H4, H5, H6, H7, H8, H9) => A): A = f(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9) } implicit def reusabilityI9[I, H1, H2, H3, H4, H5, H6, H7, H8, H9](implicit I: Reusability[I], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9]): Reusability[I9[I, H1, H2, H3, H4, H5, H6, H7, H8, H9]] = Reusability((x, y) => I.test(x.input, y.input) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9)) - class I10[+I, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, final val hook10: H10) extends I9(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9) { + @inline class I10[+I, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, final val hook10: H10) extends I9(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9) { override def toString = s"HookCtx.withInput(\n input = $input,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10)" - def apply10[A](f: (I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10) => A): A = f(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10) + @inline final def apply10[A](f: (I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10) => A): A = f(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10) } implicit def reusabilityI10[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10](implicit I: Reusability[I], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10]): Reusability[I10[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10]] = Reusability((x, y) => I.test(x.input, y.input) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9) && H10.test(x.hook10, y.hook10)) - class I11[+I, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, final val hook11: H11) extends I10(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10) { + @inline class I11[+I, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, final val hook11: H11) extends I10(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10) { override def toString = s"HookCtx.withInput(\n input = $input,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10,\n hook11 = $hook11)" - def apply11[A](f: (I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11) => A): A = f(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11) + @inline final def apply11[A](f: (I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11) => A): A = f(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11) } implicit def reusabilityI11[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11](implicit I: Reusability[I], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10], H11: Reusability[H11]): Reusability[I11[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11]] = Reusability((x, y) => I.test(x.input, y.input) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9) && H10.test(x.hook10, y.hook10) && H11.test(x.hook11, y.hook11)) - class I12[+I, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, final val hook12: H12) extends I11(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11) { + @inline class I12[+I, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, final val hook12: H12) extends I11(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11) { override def toString = s"HookCtx.withInput(\n input = $input,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10,\n hook11 = $hook11,\n hook12 = $hook12)" - def apply12[A](f: (I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12) => A): A = f(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12) + @inline final def apply12[A](f: (I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12) => A): A = f(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12) } implicit def reusabilityI12[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12](implicit I: Reusability[I], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10], H11: Reusability[H11], H12: Reusability[H12]): Reusability[I12[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12]] = Reusability((x, y) => I.test(x.input, y.input) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9) && H10.test(x.hook10, y.hook10) && H11.test(x.hook11, y.hook11) && H12.test(x.hook12, y.hook12)) - class I13[+I, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, final val hook13: H13) extends I12(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12) { + @inline class I13[+I, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, final val hook13: H13) extends I12(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12) { override def toString = s"HookCtx.withInput(\n input = $input,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10,\n hook11 = $hook11,\n hook12 = $hook12,\n hook13 = $hook13)" - def apply13[A](f: (I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13) => A): A = f(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13) + @inline final def apply13[A](f: (I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13) => A): A = f(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13) } implicit def reusabilityI13[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13](implicit I: Reusability[I], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10], H11: Reusability[H11], H12: Reusability[H12], H13: Reusability[H13]): Reusability[I13[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13]] = Reusability((x, y) => I.test(x.input, y.input) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9) && H10.test(x.hook10, y.hook10) && H11.test(x.hook11, y.hook11) && H12.test(x.hook12, y.hook12) && H13.test(x.hook13, y.hook13)) - class I14[+I, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, final val hook14: H14) extends I13(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13) { + @inline class I14[+I, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, final val hook14: H14) extends I13(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13) { override def toString = s"HookCtx.withInput(\n input = $input,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10,\n hook11 = $hook11,\n hook12 = $hook12,\n hook13 = $hook13,\n hook14 = $hook14)" - def apply14[A](f: (I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14) => A): A = f(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14) + @inline final def apply14[A](f: (I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14) => A): A = f(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14) } implicit def reusabilityI14[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14](implicit I: Reusability[I], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10], H11: Reusability[H11], H12: Reusability[H12], H13: Reusability[H13], H14: Reusability[H14]): Reusability[I14[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14]] = Reusability((x, y) => I.test(x.input, y.input) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9) && H10.test(x.hook10, y.hook10) && H11.test(x.hook11, y.hook11) && H12.test(x.hook12, y.hook12) && H13.test(x.hook13, y.hook13) && H14.test(x.hook14, y.hook14)) - class I15[+I, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, final val hook15: H15) extends I14(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14) { + @inline class I15[+I, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, final val hook15: H15) extends I14(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14) { override def toString = s"HookCtx.withInput(\n input = $input,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10,\n hook11 = $hook11,\n hook12 = $hook12,\n hook13 = $hook13,\n hook14 = $hook14,\n hook15 = $hook15)" - def apply15[A](f: (I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15) => A): A = f(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15) + @inline final def apply15[A](f: (I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15) => A): A = f(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15) } implicit def reusabilityI15[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15](implicit I: Reusability[I], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10], H11: Reusability[H11], H12: Reusability[H12], H13: Reusability[H13], H14: Reusability[H14], H15: Reusability[H15]): Reusability[I15[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15]] = Reusability((x, y) => I.test(x.input, y.input) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9) && H10.test(x.hook10, y.hook10) && H11.test(x.hook11, y.hook11) && H12.test(x.hook12, y.hook12) && H13.test(x.hook13, y.hook13) && H14.test(x.hook14, y.hook14) && H15.test(x.hook15, y.hook15)) - class I16[+I, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15, +H16](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, final val hook16: H16) extends I15(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15) { + @inline class I16[+I, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15, +H16](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, final val hook16: H16) extends I15(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15) { override def toString = s"HookCtx.withInput(\n input = $input,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10,\n hook11 = $hook11,\n hook12 = $hook12,\n hook13 = $hook13,\n hook14 = $hook14,\n hook15 = $hook15,\n hook16 = $hook16)" - def apply16[A](f: (I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16) => A): A = f(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16) + @inline final def apply16[A](f: (I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16) => A): A = f(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16) } implicit def reusabilityI16[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16](implicit I: Reusability[I], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10], H11: Reusability[H11], H12: Reusability[H12], H13: Reusability[H13], H14: Reusability[H14], H15: Reusability[H15], H16: Reusability[H16]): Reusability[I16[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16]] = Reusability((x, y) => I.test(x.input, y.input) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9) && H10.test(x.hook10, y.hook10) && H11.test(x.hook11, y.hook11) && H12.test(x.hook12, y.hook12) && H13.test(x.hook13, y.hook13) && H14.test(x.hook14, y.hook14) && H15.test(x.hook15, y.hook15) && H16.test(x.hook16, y.hook16)) - class I17[+I, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15, +H16, +H17](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, final val hook17: H17) extends I16(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16) { + @inline class I17[+I, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15, +H16, +H17](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, final val hook17: H17) extends I16(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16) { override def toString = s"HookCtx.withInput(\n input = $input,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10,\n hook11 = $hook11,\n hook12 = $hook12,\n hook13 = $hook13,\n hook14 = $hook14,\n hook15 = $hook15,\n hook16 = $hook16,\n hook17 = $hook17)" - def apply17[A](f: (I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17) => A): A = f(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17) + @inline final def apply17[A](f: (I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17) => A): A = f(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17) } implicit def reusabilityI17[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17](implicit I: Reusability[I], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10], H11: Reusability[H11], H12: Reusability[H12], H13: Reusability[H13], H14: Reusability[H14], H15: Reusability[H15], H16: Reusability[H16], H17: Reusability[H17]): Reusability[I17[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17]] = Reusability((x, y) => I.test(x.input, y.input) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9) && H10.test(x.hook10, y.hook10) && H11.test(x.hook11, y.hook11) && H12.test(x.hook12, y.hook12) && H13.test(x.hook13, y.hook13) && H14.test(x.hook14, y.hook14) && H15.test(x.hook15, y.hook15) && H16.test(x.hook16, y.hook16) && H17.test(x.hook17, y.hook17)) - class I18[+I, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15, +H16, +H17, +H18](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, final val hook18: H18) extends I17(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17) { + @inline class I18[+I, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15, +H16, +H17, +H18](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, final val hook18: H18) extends I17(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17) { override def toString = s"HookCtx.withInput(\n input = $input,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10,\n hook11 = $hook11,\n hook12 = $hook12,\n hook13 = $hook13,\n hook14 = $hook14,\n hook15 = $hook15,\n hook16 = $hook16,\n hook17 = $hook17,\n hook18 = $hook18)" - def apply18[A](f: (I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18) => A): A = f(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18) + @inline final def apply18[A](f: (I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18) => A): A = f(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18) } implicit def reusabilityI18[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18](implicit I: Reusability[I], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10], H11: Reusability[H11], H12: Reusability[H12], H13: Reusability[H13], H14: Reusability[H14], H15: Reusability[H15], H16: Reusability[H16], H17: Reusability[H17], H18: Reusability[H18]): Reusability[I18[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18]] = Reusability((x, y) => I.test(x.input, y.input) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9) && H10.test(x.hook10, y.hook10) && H11.test(x.hook11, y.hook11) && H12.test(x.hook12, y.hook12) && H13.test(x.hook13, y.hook13) && H14.test(x.hook14, y.hook14) && H15.test(x.hook15, y.hook15) && H16.test(x.hook16, y.hook16) && H17.test(x.hook17, y.hook17) && H18.test(x.hook18, y.hook18)) - class I19[+I, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15, +H16, +H17, +H18, +H19](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18, final val hook19: H19) extends I18(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18) { + @inline class I19[+I, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15, +H16, +H17, +H18, +H19](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18, final val hook19: H19) extends I18(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18) { override def toString = s"HookCtx.withInput(\n input = $input,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10,\n hook11 = $hook11,\n hook12 = $hook12,\n hook13 = $hook13,\n hook14 = $hook14,\n hook15 = $hook15,\n hook16 = $hook16,\n hook17 = $hook17,\n hook18 = $hook18,\n hook19 = $hook19)" - def apply19[A](f: (I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19) => A): A = f(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19) + @inline final def apply19[A](f: (I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19) => A): A = f(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19) } implicit def reusabilityI19[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19](implicit I: Reusability[I], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10], H11: Reusability[H11], H12: Reusability[H12], H13: Reusability[H13], H14: Reusability[H14], H15: Reusability[H15], H16: Reusability[H16], H17: Reusability[H17], H18: Reusability[H18], H19: Reusability[H19]): Reusability[I19[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19]] = Reusability((x, y) => I.test(x.input, y.input) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9) && H10.test(x.hook10, y.hook10) && H11.test(x.hook11, y.hook11) && H12.test(x.hook12, y.hook12) && H13.test(x.hook13, y.hook13) && H14.test(x.hook14, y.hook14) && H15.test(x.hook15, y.hook15) && H16.test(x.hook16, y.hook16) && H17.test(x.hook17, y.hook17) && H18.test(x.hook18, y.hook18) && H19.test(x.hook19, y.hook19)) - class I20[+I, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15, +H16, +H17, +H18, +H19, +H20](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18, hook19: H19, final val hook20: H20) extends I19(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19) { + @inline class I20[+I, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15, +H16, +H17, +H18, +H19, +H20](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18, hook19: H19, final val hook20: H20) extends I19(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19) { override def toString = s"HookCtx.withInput(\n input = $input,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10,\n hook11 = $hook11,\n hook12 = $hook12,\n hook13 = $hook13,\n hook14 = $hook14,\n hook15 = $hook15,\n hook16 = $hook16,\n hook17 = $hook17,\n hook18 = $hook18,\n hook19 = $hook19,\n hook20 = $hook20)" - def apply20[A](f: (I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20) => A): A = f(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19, hook20) + @inline final def apply20[A](f: (I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20) => A): A = f(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19, hook20) } implicit def reusabilityI20[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20](implicit I: Reusability[I], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10], H11: Reusability[H11], H12: Reusability[H12], H13: Reusability[H13], H14: Reusability[H14], H15: Reusability[H15], H16: Reusability[H16], H17: Reusability[H17], H18: Reusability[H18], H19: Reusability[H19], H20: Reusability[H20]): Reusability[I20[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20]] = Reusability((x, y) => I.test(x.input, y.input) && H1.test(x.hook1, y.hook1) && H2.test(x.hook2, y.hook2) && H3.test(x.hook3, y.hook3) && H4.test(x.hook4, y.hook4) && H5.test(x.hook5, y.hook5) && H6.test(x.hook6, y.hook6) && H7.test(x.hook7, y.hook7) && H8.test(x.hook8, y.hook8) && H9.test(x.hook9, y.hook9) && H10.test(x.hook10, y.hook10) && H11.test(x.hook11, y.hook11) && H12.test(x.hook12, y.hook12) && H13.test(x.hook13, y.hook13) && H14.test(x.hook14, y.hook14) && H15.test(x.hook15, y.hook15) && H16.test(x.hook16, y.hook16) && H17.test(x.hook17, y.hook17) && H18.test(x.hook18, y.hook18) && H19.test(x.hook19, y.hook19) && H20.test(x.hook20, y.hook20)) - class I21[+I, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15, +H16, +H17, +H18, +H19, +H20, +H21](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18, hook19: H19, hook20: H20, final val hook21: H21) extends I20(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19, hook20) { + @inline class I21[+I, +H1, +H2, +H3, +H4, +H5, +H6, +H7, +H8, +H9, +H10, +H11, +H12, +H13, +H14, +H15, +H16, +H17, +H18, +H19, +H20, +H21](input: I, hook1: H1, hook2: H2, hook3: H3, hook4: H4, hook5: H5, hook6: H6, hook7: H7, hook8: H8, hook9: H9, hook10: H10, hook11: H11, hook12: H12, hook13: H13, hook14: H14, hook15: H15, hook16: H16, hook17: H17, hook18: H18, hook19: H19, hook20: H20, final val hook21: H21) extends I20(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19, hook20) { override def toString = s"HookCtx.withInput(\n input = $input,\n hook1 = $hook1,\n hook2 = $hook2,\n hook3 = $hook3,\n hook4 = $hook4,\n hook5 = $hook5,\n hook6 = $hook6,\n hook7 = $hook7,\n hook8 = $hook8,\n hook9 = $hook9,\n hook10 = $hook10,\n hook11 = $hook11,\n hook12 = $hook12,\n hook13 = $hook13,\n hook14 = $hook14,\n hook15 = $hook15,\n hook16 = $hook16,\n hook17 = $hook17,\n hook18 = $hook18,\n hook19 = $hook19,\n hook20 = $hook20,\n hook21 = $hook21)" - def apply21[A](f: (I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20, H21) => A): A = f(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19, hook20, hook21) + @inline final def apply21[A](f: (I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20, H21) => A): A = f(input, hook1, hook2, hook3, hook4, hook5, hook6, hook7, hook8, hook9, hook10, hook11, hook12, hook13, hook14, hook15, hook16, hook17, hook18, hook19, hook20, hook21) } implicit def reusabilityI21[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20, H21](implicit I: Reusability[I], H1: Reusability[H1], H2: Reusability[H2], H3: Reusability[H3], H4: Reusability[H4], H5: Reusability[H5], H6: Reusability[H6], H7: Reusability[H7], H8: Reusability[H8], H9: Reusability[H9], H10: Reusability[H10], H11: Reusability[H11], H12: Reusability[H12], H13: Reusability[H13], H14: Reusability[H14], H15: Reusability[H15], H16: Reusability[H16], H17: Reusability[H17], H18: Reusability[H18], H19: Reusability[H19], H20: Reusability[H20], H21: Reusability[H21]): Reusability[I21[I, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20, H21]] = diff --git a/library/project/GenHooks.scala b/library/project/GenHooks.scala index c9194789d..7579d2142 100644 --- a/library/project/GenHooks.scala +++ b/library/project/GenHooks.scala @@ -60,14 +60,20 @@ object GenHooks { |""".stripMargin if (n <= 21) { - hookCtxCtorsI += s" def apply[I, $Hns](input: I, $hookParams): I$n[I, $Hns] =\n new I$n(input, $hookArgs)" + hookCtxCtorsI += + s""" @inline def apply[I, $Hns](input: I, $hookParams): I$n[I, $Hns] = + | new I$n(input, $hookArgs) + |""".stripMargin - hookCtxCtorsP += s" def apply[P, $Hns](props: P, $hookParams): P$n[P, $Hns] =\n new P$n(props, $hookArgs)" + hookCtxCtorsP += + s""" @inline def apply[P, $Hns](props: P, $hookParams): P$n[P, $Hns] = + | new P$n(props, $hookArgs) + |""".stripMargin hookCtxsI += - s""" class I$n[+I, $coHns](input: I, $ctxParams) extends I${n-1}(input$ctxSuperArgs) { + s""" @inline class I$n[+I, $coHns](input: I, $ctxParams) extends I${n-1}(input$ctxSuperArgs) { | override def toString = s"HookCtx.withInput(\\n input = !input$ctxToStr)" - | def apply$n[A](f: (I, $Hns) => A): A = f(input, $hookArgs) + | @inline final def apply$n[A](f: (I, $Hns) => A): A = f(input, $hookArgs) | } | | implicit def reusabilityI$n[I, $Hns](implicit I: Reusability[I], $RHns): Reusability[I$n[I, $Hns]] = @@ -75,9 +81,9 @@ object GenHooks { |""".stripMargin.replace('!', '$') hookCtxsP += - s""" class P$n[+P, $coHns](props: P, $ctxParams) extends P${n-1}(props$ctxSuperArgs) { + s""" @inline class P$n[+P, $coHns](props: P, $ctxParams) extends P${n-1}(props$ctxSuperArgs) { | override def toString = s"HookCtx(\\n props = !props$ctxToStr)" - | def apply$n[A](f: (P, $Hns) => A): A = f(props, $hookArgs) + | @inline final def apply$n[A](f: (P, $Hns) => A): A = f(props, $hookArgs) | } | | implicit def reusabilityP$n[P, $Hns](implicit P: Reusability[P], $RHns): Reusability[P$n[P, $Hns]] = @@ -85,12 +91,15 @@ object GenHooks { |""".stripMargin.replace('!', '$') if (n <= 20) { - hookCtxCtorsPC += s" def apply[P, $Hns](props: P, propsChildren: PropsChildren, $hookParams): PC$n[P, $Hns] =\n new PC$n(props, propsChildren, $hookArgs)" + hookCtxCtorsPC += + s""" @inline def apply[P, $Hns](props: P, propsChildren: PropsChildren, $hookParams): PC$n[P, $Hns] = + | new PC$n(props, propsChildren, $hookArgs) + |""".stripMargin hookCtxsPC += - s""" class PC$n[+P, $coHns](props: P, propsChildren: PropsChildren, $ctxParams) extends PC${n-1}(props, propsChildren$ctxSuperArgs) { + s""" @inline class PC$n[+P, $coHns](props: P, propsChildren: PropsChildren, $ctxParams) extends PC${n-1}(props, propsChildren$ctxSuperArgs) { | override def toString = s"HookCtx.withChildren(\\n props = !props,\\n propsChildren = !propsChildren$ctxToStr)" - | def apply$n[A](f: (P, PropsChildren, $Hns) => A): A = f(props, propsChildren, $hookArgs) + | @inline final def apply$n[A](f: (P, PropsChildren, $Hns) => A): A = f(props, propsChildren, $hookArgs) | } | | implicit def reusabilityPC$n[P, $Hns](implicit P: Reusability[P], PC: Reusability[PropsChildren], $RHns): Reusability[PC$n[P, $Hns]] = @@ -213,9 +222,9 @@ object GenHooks { | |object HookCtx { | - |${hookCtxCtorsP.result().mkString("\n\n")} + |${hookCtxCtorsP.result().mkString("\n")} | - | abstract class P0[+P](final val props: P) + | @inline abstract class P0[+P](final val props: P) | | implicit def reusabilityP0[P](implicit P: Reusability[P]): Reusability[P0[P]] = | Reusability.by(_.props) @@ -225,13 +234,13 @@ object GenHooks { | | object withChildren { | - | def apply[P](props: P, propsChildren: PropsChildren): PC0[P] = + | @inline def apply[P](props: P, propsChildren: PropsChildren): PC0[P] = | new PC0(props, propsChildren) | - |${hookCtxCtorsPC.result().mkString("\n\n")} + |${hookCtxCtorsPC.result().mkString("\n")} | } | - | class PC0[+P](props: P, final val propsChildren: PropsChildren) extends P0(props) + | @inline class PC0[+P](props: P, final val propsChildren: PropsChildren) extends P0(props) | | implicit def reusabilityPC0[P](implicit P: Reusability[P], PC: Reusability[PropsChildren]): Reusability[PC0[P]] = | Reusability((x, y) => P.test(x.props, y.props) && PC.test(x.propsChildren, y.propsChildren)) @@ -242,13 +251,13 @@ object GenHooks { | | object withInput { | - | def apply[I](input: I): I0[I] = + | @inline def apply[I](input: I): I0[I] = | new I0(input) | - |${hookCtxCtorsI.result().mkString("\n\n")} + |${hookCtxCtorsI.result().mkString("\n")} | } | - | class I0[+I](final val input: I) + | @inline class I0[+I](final val input: I) | | implicit def reusabilityI0[I](implicit I: Reusability[I]): Reusability[I0[I]] = | Reusability.by(_.input) diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out2.js index 0de575fc5..b605ce568 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out2.js @@ -8,7 +8,6 @@ import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024 from import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First from "./japgolly.scalajs.react.hooks.CustomHook$Builder$First.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024Subsequent from "./japgolly.scalajs.react.hooks.CustomHook$Builder$Subsequent.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024I1 from "./japgolly.scalajs.react.hooks.HookCtx$I1.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2 from "./japgolly.scalajs.react.hooks.HookCtx$P2.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF from "./japgolly.scalajs.react.hooks.Hooks$UseStateF.js"; import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 from "./japgolly.scalajs.react.internal.Singleton$.js"; import * as $j_japgolly$002escalajs$002ereact$002epackage$0024 from "./japgolly.scalajs.react.package$.js"; @@ -81,20 +80,16 @@ $c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$.prototype.japgolly$scal var hook1 = hook1_raw.apply__O__O(void 0); var hook2_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1($m_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$().Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook2, hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]); var hook2 = hook2_raw.apply__O__O(void 0); - var props$1 = props.a; - var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, hook1, hook2); - var $$x2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); - var $$x1 = $m_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$().Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook3; - var this$2 = hook3_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; - var hook3_raw = $$x2.apply$extension__F1__O__F1($$x1, this$2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]); + props.a; + var hook3_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1($m_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$().Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook3, hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]); var hook3 = hook3_raw.apply__O__O(void 0); var sum = (((props.a | 0) + (hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (hook3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0; - var $$x3 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + var $$x1 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum))]; - var this$12 = $$x3.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("div", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); - return $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement.$f_Ljapgolly_scalajs_react_vdom_VdomElement__rawNode__sjs_js_$bar(this$12); + var this$11 = $$x1.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("div", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); + return $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement.$f_Ljapgolly_scalajs_react_vdom_VdomElement__rawNode__sjs_js_$bar(this$11); }; var $d_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$ = new $j_java$002elang$002eObject.$TypeData().initClass({ diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out3.js index ac335d4d8..9151e0b18 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out3.js @@ -8,7 +8,6 @@ import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024 from import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First from "./japgolly.scalajs.react.hooks.CustomHook$Builder$First.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024Subsequent from "./japgolly.scalajs.react.hooks.CustomHook$Builder$Subsequent.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024I1 from "./japgolly.scalajs.react.hooks.HookCtx$I1.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2 from "./japgolly.scalajs.react.hooks.HookCtx$P2.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF from "./japgolly.scalajs.react.hooks.Hooks$UseStateF.js"; import * as $j_japgolly$002escalajs$002ereact$002epackage$0024 from "./japgolly.scalajs.react.package$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; @@ -69,28 +68,24 @@ function $c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$() { props.a | 0; var hook2_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1(this$7$1.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook2, hook1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); var hook2 = hook2_raw.apply__O__O(void 0); - var props$1 = props.a; - var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, hook1, hook2); - var $$x2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); - var $$x1 = this$7$1.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook3; - var this$9 = hook3_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; - var hook3_raw = $$x2.apply$extension__F1__O__F1($$x1, this$9.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); + props.a; + var hook3_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1(this$7$1.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook3, hook2.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); var hook3 = hook3_raw.apply__O__O(void 0); var p$2 = props.a | 0; var sum = ((p$2 + (hook1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (hook2.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (hook3.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; - var this$16 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + var this$15 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); var self = "div"; var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum))])); - var this$17 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$16, self, xs); - return this$17.rawElement__Ljapgolly_scalajs_react_facade_React$Element(); + var this$16 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$15, self, xs); + return this$16.rawElement__Ljapgolly_scalajs_react_facade_React$Element(); })(this); - var $$x3 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); - var this$18 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$17 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); - this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_Component = $$x3.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$18.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); + this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$17.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); } export { $c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksPrimative-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksPrimative-out2.js index 7064a7313..fe4d0a3b8 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksPrimative-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksPrimative-out2.js @@ -3,10 +3,6 @@ import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P1 from "./japgolly.scalajs.react.hooks.HookCtx$P1.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P4 from "./japgolly.scalajs.react.hooks.HookCtx$P4.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P7 from "./japgolly.scalajs.react.hooks.HookCtx$P7.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P9 from "./japgolly.scalajs.react.hooks.HookCtx$P9.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024VarF from "./japgolly.scalajs.react.hooks.Hooks$VarF.js"; import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 from "./japgolly.scalajs.react.internal.Singleton$.js"; import * as $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024 from "./japgolly.scalajs.react.util.DefaultEffects$.js"; @@ -16,7 +12,6 @@ import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$00 import * as $j_java$002elang$002eNullPointerException from "./java.lang.NullPointerException.js"; import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; import * as $j_scala$002eruntime$002eLazyInt from "./scala.runtime.LazyInt.js"; -import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; function $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook4_raw$lzycompute$1__sr_LazyInt__I($thiz, hook4_raw$lzy$1) { if (hook4_raw$lzy$1 === null) { @@ -94,26 +89,19 @@ $c_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$.prototype.japgolly$sca var hook4_raw$lzy = new $j_scala$002eruntime$002eLazyInt.$c_sr_LazyInt(); var hook5_raw$lzy = new $j_scala$002eruntime$002eLazyInt.$c_sr_LazyInt(); var hook6_raw$lzy = new $j_scala$002eruntime$002eLazyInt.$c_sr_LazyInt(); - var props$1 = props.a; - $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P1.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P1__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P1.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P1(), props$1, 1111); - var hook4 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((this$2, hook4_raw$lzy$1) => () => $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook4_raw$1__sr_LazyInt__I(this$2, hook4_raw$lzy$1))(this, hook4_raw$lzy)); - var props$2 = props.a; - $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P4.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P4__O__O__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P4.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P4(), props$2, 1111, 2222, 3333, hook4); - var hook5 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((this$2$1, hook5_raw$lzy$1) => () => $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook5_raw$1__sr_LazyInt__I(this$2$1, hook5_raw$lzy$1))(this, hook5_raw$lzy)); - var hook6 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((this$3$1, hook6_raw$lzy$1) => () => $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook6_raw$1__sr_LazyInt__I(this$3$1, hook6_raw$lzy$1))(this, hook6_raw$lzy)); - var this$5 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); - var hook7 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024VarF.$c_Ljapgolly_scalajs_react_hooks_Hooks$VarF(7777, this$5.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); - var props$3 = props.a; - $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P7.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P7__O__O__O__O__O__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P7.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P7(), props$3, 1111, 2222, 3333, hook4, hook5, hook6, hook7); - var this$8 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); - var hook8 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024VarF.$c_Ljapgolly_scalajs_react_hooks_Hooks$VarF(8888, this$8.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); - var this$10 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); - var hook9 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024VarF.$c_Ljapgolly_scalajs_react_hooks_Hooks$VarF(9999, this$10.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + props.a; + props.a; + var this$4 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); + var hook7 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024VarF.$c_Ljapgolly_scalajs_react_hooks_Hooks$VarF(7777, this$4.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + props.a; + var this$7 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); + var hook8 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024VarF.$c_Ljapgolly_scalajs_react_hooks_Hooks$VarF(8888, this$7.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + var this$9 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); + var hook9 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024VarF.$c_Ljapgolly_scalajs_react_hooks_Hooks$VarF(9999, this$9.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); console.log("aaaaa"); - var props$4 = props.a; - new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P9.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P9(props$4, 1111, 2222, 3333, hook4, hook5, hook6, hook7, hook8, hook9); + props.a; console.log("ccccc"); - var sum = ((((((6666 + (hook4.apply__O() | 0) | 0) + (hook5.apply__O() | 0) | 0) + (hook6.apply__O() | 0) | 0) + (hook7.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + (hook8.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + (hook9.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + ("bbbbb".length | 0) | 0; + var sum = ((((((6666 + $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook4_raw$1__sr_LazyInt__I(this, hook4_raw$lzy) | 0) + $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook5_raw$1__sr_LazyInt__I(this, hook5_raw$lzy) | 0) + $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook6_raw$1__sr_LazyInt__I(this, hook6_raw$lzy) | 0) + (hook7.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + (hook8.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + (hook9.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + ("bbbbb".length | 0) | 0; $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); return new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksPrimative-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksPrimative-out3.js index 8f2cc64bc..428bbe70e 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksPrimative-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksPrimative-out3.js @@ -3,10 +3,6 @@ import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P1 from "./japgolly.scalajs.react.hooks.HookCtx$P1.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P4 from "./japgolly.scalajs.react.hooks.HookCtx$P4.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P7 from "./japgolly.scalajs.react.hooks.HookCtx$P7.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P9 from "./japgolly.scalajs.react.hooks.HookCtx$P9.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024VarF from "./japgolly.scalajs.react.hooks.Hooks$VarF.js"; import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 from "./japgolly.scalajs.react.internal.Singleton$.js"; import * as $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024 from "./japgolly.scalajs.react.util.DefaultEffects$.js"; @@ -16,7 +12,6 @@ import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$00 import * as $j_java$002elang$002eNullPointerException from "./java.lang.NullPointerException.js"; import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; import * as $j_scala$002eruntime$002eLazyInt from "./scala.runtime.LazyInt.js"; -import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; function $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook5_raw$lzyINIT1$1__sr_LazyInt__I($thiz, hook5_raw$lzy1$1) { if (hook5_raw$lzy1$1 === null) { @@ -60,37 +55,30 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$() { new $j_scala$002eruntime$002eLazyInt.$c_sr_LazyInt(); var hook5_raw$lzy1 = new $j_scala$002eruntime$002eLazyInt.$c_sr_LazyInt(); var hook6_raw$lzy1 = new $j_scala$002eruntime$002eLazyInt.$c_sr_LazyInt(); - var props$1 = props.a; - $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P1.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P1__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P1.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P1(), props$1, 1111); - var hook4 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => 4444); - var props$2 = props.a; - $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P4.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P4__O__O__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P4.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P4(), props$2, 1111, 2222, 3333, hook4); - var hook5_raw$lzy1$2$1 = hook5_raw$lzy1; - var hook5 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((this$2$1, hook5_raw$lzy1$2) => () => $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook5_raw$1__sr_LazyInt__I(this$2$1, hook5_raw$lzy1$2))(this$1, hook5_raw$lzy1$2$1)); - var hook6_raw$lzy1$2$1 = hook6_raw$lzy1; - var hook6 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((this$3$1, hook6_raw$lzy1$2) => () => $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook6_raw$1__sr_LazyInt__I(this$3$1, hook6_raw$lzy1$2))(this$1, hook6_raw$lzy1$2$1)); - var this$6 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); - var hook7 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024VarF.$c_Ljapgolly_scalajs_react_hooks_Hooks$VarF(7777, this$6.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); - var props$3 = props.a; - $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P7.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P7__O__O__O__O__O__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P7.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P7(), props$3, 1111, 2222, 3333, hook4, hook5, hook6, hook7); - var this$9 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); - var hook8 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024VarF.$c_Ljapgolly_scalajs_react_hooks_Hooks$VarF(8888, this$9.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); - var this$11 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); - var hook9 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024VarF.$c_Ljapgolly_scalajs_react_hooks_Hooks$VarF(9999, this$11.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + props.a; + props.a; + var hook5_raw$lzy1$2 = hook5_raw$lzy1; + var hook6_raw$lzy1$2 = hook6_raw$lzy1; + var this$5 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); + var hook7 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024VarF.$c_Ljapgolly_scalajs_react_hooks_Hooks$VarF(7777, this$5.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + props.a; + var this$8 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); + var hook8 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024VarF.$c_Ljapgolly_scalajs_react_hooks_Hooks$VarF(8888, this$8.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + var this$10 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); + var hook9 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024VarF.$c_Ljapgolly_scalajs_react_hooks_Hooks$VarF(9999, this$10.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); console.log("aaaaa"); - var props$4 = props.a; - new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P9.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P9(props$4, 1111, 2222, 3333, hook4, hook5, hook6, hook7, hook8, hook9); + props.a; props.a; console.log("ccccc"); props.a; - var sum = ((((((6666 + (hook4.apply__O() | 0) | 0) + (hook5.apply__O() | 0) | 0) + (hook6.apply__O() | 0) | 0) + (hook7.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + (hook8.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + (hook9.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + ("bbbbb".length | 0) | 0; + var sum = (((((11110 + $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook5_raw$1__sr_LazyInt__I(this$1, hook5_raw$lzy1$2) | 0) + $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook6_raw$1__sr_LazyInt__I(this$1, hook6_raw$lzy1$2) | 0) + (hook7.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + (hook8.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + (hook9.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + ("bbbbb".length | 0) | 0; return ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; })(this); var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); - var this$15 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var this$14 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonN__Ljapgolly_scalajs_react_internal_Singleton__Ljapgolly_scalajs_react_CtorType$Summoner($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$().Ljapgolly_scalajs_react_internal_Singleton$__f_BoxUnit); - this.Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$15.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); + this.Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$14.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); } export { $c_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxFn-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxFn-out2.js index 5cef89e4f..51df1d6bb 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxFn-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxFn-out2.js @@ -4,7 +4,7 @@ var _s = $RefreshSig$(); import * as $i_react from "react"; import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ePropsChildren from "./japgolly.scalajs.react.PropsChildren.js"; +import * as $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024 from "./japgolly.scalajs.react.PropsChildren$.js"; import * as $j_japgolly$002escalajs$002ereact$002eReusable$0024 from "./japgolly.scalajs.react.Reusable$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; @@ -48,13 +48,13 @@ $h_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$.prototype = $c $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$.prototype.japgolly$scalajs$react$test$emissions$HooksWithChildrenCtxFn$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s(function (props) { _s(); - var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren.$m_Ljapgolly_scalajs_react_PropsChildren$().fromRawProps__sjs_js_Object__sjs_js_Any(props); + var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$().fromRawProps__sjs_js_Object__sjs_js_Any(props); var hook1_raw = $i_react.useState(() => { $m_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$(); return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123); }); var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); - var sum = ((props.a | 0) + (hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + $j_japgolly$002escalajs$002ereact$002ePropsChildren.$m_Ljapgolly_scalajs_react_PropsChildren$().count$extension__sjs_js_Any__I(children) | 0; + var sum = ((props.a | 0) + (hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$().count$extension__sjs_js_Any__I(children) | 0; var $$x1 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxObj-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxObj-out2.js index cbd016dbf..e80de7538 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxObj-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxObj-out2.js @@ -4,12 +4,10 @@ var _s = $RefreshSig$(); import * as $i_react from "react"; import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ePropsChildren from "./japgolly.scalajs.react.PropsChildren.js"; +import * as $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024 from "./japgolly.scalajs.react.PropsChildren$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024PC1 from "./japgolly.scalajs.react.hooks.HookCtx$PC1.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF from "./japgolly.scalajs.react.hooks.Hooks$UseStateF.js"; import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 from "./japgolly.scalajs.react.internal.Singleton$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; @@ -40,17 +38,14 @@ $h_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$.prototype = $ $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$.prototype.japgolly$scalajs$react$test$emissions$HooksWithChildrenCtxObj$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s(function (props) { _s(); - var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren.$m_Ljapgolly_scalajs_react_PropsChildren$().fromRawProps__sjs_js_Object__sjs_js_Any(props); + var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$().fromRawProps__sjs_js_Object__sjs_js_Any(props); var hook1_raw = $i_react.useState(() => { $m_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$(); return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123); }); var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); var props$1 = props.a; - var hook2_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024PC1.$c_Ljapgolly_scalajs_react_hooks_HookCtx$PC1(props$1, children, hook1); - var $$x1 = hook2_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; - var this$3 = hook2_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$PC1__f_hook1; - var sum = (($$x1 | 0) + (this$3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + $j_japgolly$002escalajs$002ereact$002ePropsChildren.$m_Ljapgolly_scalajs_react_PropsChildren$().count$extension__sjs_js_Any__I(hook2_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$PC0__f_propsChildren) | 0; + var sum = ((props$1 | 0) + (hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$().count$extension__sjs_js_Any__I(children) | 0; $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); return new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxObj-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxObj-out3.js index be38e5c63..564ae211f 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxObj-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxObj-out3.js @@ -5,9 +5,7 @@ import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 fro import * as $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024package$0024PropsChildren$0024 from "./japgolly.scalajs.react.PropsChildren$package$PropsChildren$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024PC1 from "./japgolly.scalajs.react.hooks.HookCtx$PC1.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF from "./japgolly.scalajs.react.hooks.Hooks$UseStateF.js"; import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; @@ -27,21 +25,16 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$() { var hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); var props$1 = props.a; - var hook2_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024PC1.$c_Ljapgolly_scalajs_react_hooks_HookCtx$PC1(props$1, children, hook1); - var $$x2 = hook2_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; - var this$4 = hook2_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$PC1__f_hook1; - var $$x1 = this$4.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; - var self = hook2_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$PC0__f_propsChildren; - var sum = (($$x2 | 0) + ($$x1 | 0) | 0) + ($i_react.Children.count(self) | 0) | 0; + var sum = ((props$1 | 0) + (hook1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + ($i_react.Children.count(children) | 0) | 0; return ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; }; _s(rawComponent, "+3ihSvpsaY0Wt3tAhbVZmTm3dGg="); - var $$x3 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); - var this$8 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$7 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonPC__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); - this.Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$__f_Component = $$x3.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$8.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); + this.Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$7.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); } export { $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out2.js index 3ca783af8..88981b56e 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out2.js @@ -122,7 +122,7 @@ $c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$.prototype.japgolly$sca var hook2_raw = $i_react.useState(((props$1, hook1$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$().japgolly$scalajs$react$test$emissions$HooksWithJsFns$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box(props$1, hook1$1))(props, hook1)); var hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); var props$2 = props.a; - var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$2, hook1, hook2); + var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$2, hook1, hook2); var hook3_raw = $i_react.useState((hook3_ctx$1 => () => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$().japgolly$scalajs$react$test$emissions$HooksWithJsFns$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box(hook3_ctx$1))(hook3_ctx)); var hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); return $j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction4__sjs_js_Function4__F4($p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__render__sjs_js_Function4($m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$())).apply__O__O__O__O__O(props.a, hook1, hook2, hook3).rawNode__sjs_js_$bar(); diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out3.js index a8152d504..7dc0c1efa 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out3.js @@ -88,7 +88,7 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$() { var hook2_raw = $i_react.useState(((this$2$2, props$2, hook1$2) => () => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction2__sjs_js_Function2__F2($p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__jsState1__sjs_js_Function2(this$2$2)).apply__O__O__O(props$2.a, hook1$2)))(this$2$1, props, hook1)); var hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); var props$1 = props.a; - var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, hook1, hook2); + var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$1, hook1, hook2); var hook3_raw = $i_react.useState(((this$3$1, hook3_ctx$2) => () => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction1__sjs_js_Function1__F1(this$3$1.Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__f_jsState2).apply__O__O(hook3_ctx$2)))(this$2$1, hook3_ctx)); var hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); return $j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction4__sjs_js_Function4__F4($p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__render__sjs_js_Function4(this$2$1)).apply__O__O__O__O__O(props.a, hook1, hook2, hook3).rawNode__O(); diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out2.js index 49cda9f3b..5148831a1 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out2.js @@ -111,7 +111,7 @@ $c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$.prototype.japgolly$ var hook2_raw = $i_react.useState(((props$1, hook1$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$().japgolly$scalajs$react$test$emissions$HooksWithScalaFns$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box(props$1, hook1$1))(props, hook1)); var hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); var props$2 = props.a; - var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$2, hook1, hook2); + var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$2, hook1, hook2); var hook3_raw = $i_react.useState((hook3_ctx$1 => () => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$().japgolly$scalajs$react$test$emissions$HooksWithScalaFns$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box(hook3_ctx$1))(hook3_ctx)); var hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); var hook4_raw = $i_react.useState(((props$1$1, hook1$1$1, hook2$1, hook3$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$().japgolly$scalajs$react$test$emissions$HooksWithScalaFns$$$anonfun$Component$5__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box(props$1$1, hook1$1$1, hook2$1, hook3$1))(props, hook1, hook2, hook3)); diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out3.js index 10477268d..adf1f6e1b 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out3.js @@ -88,7 +88,7 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$() { })(this$3$1, props, hook1)); var hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); var props$1 = props.a; - var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, hook1, hook2); + var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$1, hook1, hook2); var hook3_raw = $i_react.useState(((this$3$2, hook3_ctx$2) => () => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(this$3$2.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state2.apply__O__O(hook3_ctx$2)))(this$3$1, hook3_ctx)); var hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); var hook4_raw = $i_react.useState(((this$4$1, props$3, hook1$3, hook2$2, hook3$2) => () => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(this$4$1.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state3.apply__O__O__O__O__O(props$3.a, hook1$3, hook2$2, hook3$2)))(this$3$1, props, hook1, hook2, hook3)); diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/JustPropsChildrenViaHookApi-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/JustPropsChildrenViaHookApi-out2.js index a5e174b26..9617d0dd8 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/JustPropsChildrenViaHookApi-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/JustPropsChildrenViaHookApi-out2.js @@ -1,7 +1,7 @@ 'use strict'; import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ePropsChildren from "./japgolly.scalajs.react.PropsChildren.js"; +import * as $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024 from "./japgolly.scalajs.react.PropsChildren$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 from "./japgolly.scalajs.react.internal.Singleton$.js"; @@ -32,8 +32,8 @@ export { $h_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$ $h_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$.prototype; $c_Ljapgolly_scalajs_react_test_emissions_JustPropsChildrenViaHookApi$.prototype.japgolly$scalajs$react$test$emissions$JustPropsChildrenViaHookApi$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = function (props) { - var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren.$m_Ljapgolly_scalajs_react_PropsChildren$().fromRawProps__sjs_js_Object__sjs_js_Any(props); - var sum = (props.a | 0) + $j_japgolly$002escalajs$002ereact$002ePropsChildren.$m_Ljapgolly_scalajs_react_PropsChildren$().count$extension__sjs_js_Any__I(children) | 0; + var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$().fromRawProps__sjs_js_Object__sjs_js_Any(props); + var sum = (props.a | 0) + $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$().count$extension__sjs_js_Any__I(children) | 0; $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); return new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out2.js index 591d4fb47..714fe06f4 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out2.js @@ -70,7 +70,7 @@ $c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype.japgolly$scalajs$r var hook2_raw = $i_react.useState(((props$1, hook1$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_UseState$().japgolly$scalajs$react$test$emissions$UseState$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box(props$1, hook1$1))(props, hook1)); var hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); var props$2 = props.a; - var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$2, hook1, hook2); + var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$2, hook1, hook2); var hook3_raw = $i_react.useState((hook3_ctx$1 => () => $m_Ljapgolly_scalajs_react_test_emissions_UseState$().japgolly$scalajs$react$test$emissions$UseState$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box(hook3_ctx$1))(hook3_ctx)); var hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); var sum = ((hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) + (hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (hook3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out3.js index 3e30171ff..41510159c 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out3.js @@ -41,7 +41,7 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseState$() { })(props, hook1)); var hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); var props$1 = props.a; - var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, hook1, hook2); + var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$1, hook1, hook2); var hook3_raw = $i_react.useState((hook3_ctx$2 => () => { var $$x4 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); var $$x3 = hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out2.js index b17402c3e..7025c98f3 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out2.js @@ -9,7 +9,6 @@ import * as $j_japgolly$002escalajs$002ereact$002eReusable$0024 from "./japgolly import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2 from "./japgolly.scalajs.react.hooks.HookCtx$P2.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P3 from "./japgolly.scalajs.react.hooks.HookCtx$P3.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF from "./japgolly.scalajs.react.hooks.Hooks$UseStateF.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF from "./japgolly.scalajs.react.hooks.Hooks$UseStateWithReuseF.js"; @@ -83,7 +82,7 @@ $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$.prototype.japgolly$ var us$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$11, r$1); var hook2 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us$1, rr$1, ct$1); var props$2 = props.a; - var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$2, hook1, hook2); + var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$2, hook1, hook2); var hook3_raw = $i_react.useState((hook3_ctx$1 => () => $m_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$().japgolly$scalajs$react$test$emissions$UseStateWithReuse$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box(hook3_ctx$1))(hook3_ctx)); var this$13 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); var r$2 = this$13.by_$eq$eq__F2(); @@ -92,17 +91,13 @@ $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$.prototype.japgolly$ var this$17 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); var us$2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$17, r$2); var hook3 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us$2, rr$2, ct$2); - var props$3 = props.a; - var hook4_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P3.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P3(props$3, hook1, hook2, hook3); - var this$19 = hook4_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; - var this$20 = this$19.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - var $$x2 = this$20.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]; - var this$21 = hook4_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; - var this$22 = this$21.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - var $$x1 = this$22.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]; - var this$23 = hook4_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P3__f_hook3; - var this$24 = this$23.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - var sum = (($$x2 | 0) + ($$x1 | 0) | 0) + (this$24.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0; + props.a; + var this$19 = hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var $$x2 = this$19.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]; + var this$20 = hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var $$x1 = this$20.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]; + var this$21 = hook3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var sum = (($$x2 | 0) + ($$x1 | 0) | 0) + (this$21.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0; $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); return new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out3.js index 1ecaeef85..ec1444e7d 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out3.js @@ -7,7 +7,6 @@ import * as $j_japgolly$002escalajs$002ereact$002eReusable$0024 from "./japgolly import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2 from "./japgolly.scalajs.react.hooks.HookCtx$P2.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P3 from "./japgolly.scalajs.react.hooks.HookCtx$P3.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF from "./japgolly.scalajs.react.hooks.Hooks$UseStateF.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF from "./japgolly.scalajs.react.hooks.Hooks$UseStateWithReuseF.js"; @@ -49,7 +48,7 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$() { var us$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$16, r$1); var hook2 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us$1, rr$1, ct$1); var props$1 = props.a; - var hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, hook1, hook2); + var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$1, hook1, hook2); var hook3_raw = $i_react.useState((hook3_ctx$2 => () => { var $$x4 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); var $$x3 = hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; @@ -67,26 +66,22 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$() { var this$28 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); var us$2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$28, r$2); var hook3 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us$2, rr$2, ct$2); - var props$3 = props.a; - var hook4_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P3.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P3(props$3, hook1, hook2, hook3); - var this$31 = hook4_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; - var this$32 = this$31.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - var $$x6 = this$32.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; - var this$33 = hook4_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; - var this$34 = this$33.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - var $$x5 = this$34.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; - var this$35 = hook4_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P3__f_hook3; - var this$36 = this$35.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - var sum = (($$x6 | 0) + ($$x5 | 0) | 0) + (this$36.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; + props.a; + var this$31 = hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var $$x6 = this$31.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; + var this$32 = hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var $$x5 = this$32.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; + var this$33 = hook3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var sum = (($$x6 | 0) + ($$x5 | 0) | 0) + (this$33.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; return ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; }; _s(rawComponent, "+059i36eGzSqNFL1PwYIRLAIpQ4="); var $$x7 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); - var this$39 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var this$36 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); - this.Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$__f_Component = $$x7.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$39.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); + this.Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$__f_Component = $$x7.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$36.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); } export { $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$ }; From 63a2045e099673f450500906f92c2ef10d91bafa Mon Sep 17 00:00:00 2001 From: David Barri Date: Tue, 21 Jun 2022 14:53:15 +1000 Subject: [PATCH 56/72] Got `useCallback` working --- .../scalajs/react/hooks/HookMacros.scala | 25 +++- .../scalajs/react/hooks/HookMacros.scala | 32 ++++- .../react/hooks/AbstractHookMacros.scala | 51 ++++++-- .../japgolly/scalajs/react/hooks/Hooks.scala | 12 +- .../japgolly/scalajs/react/facade/Hooks.scala | 10 +- library/mktmp | 65 ++++++++++ .../scalajs/react/test/emissions/Main.scala | 1 + .../react/test/emissions/UseCallback.scala | 20 ++++ .../test/resources/rr-sjr/UseCallback-out2.js | 95 +++++++++++++++ .../test/resources/rr-sjr/UseCallback-out3.js | 113 ++++++++++++++++++ .../test/emissions/ReactRefreshTest.scala | 1 + 11 files changed, 396 insertions(+), 29 deletions(-) create mode 100755 library/mktmp create mode 100644 library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseCallback.scala create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/UseCallback-out2.js create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/UseCallback-out3.js diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala index d46d3d007..b9367be8e 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -3,8 +3,9 @@ package japgolly.scalajs.react.hooks import japgolly.microlibs.compiletime.MacroUtils import japgolly.scalajs.react.Children import japgolly.scalajs.react.hooks.Api._ -import japgolly.scalajs.react.internal.Box +import japgolly.scalajs.react.internal.{Box, MacroLogger} import scala.reflect.macros.blackbox.Context +import scala.scalajs.js class HookMacros(val c: Context) extends MacroUtils { import c.universe._ @@ -54,6 +55,7 @@ class HookMacros(val c: Context) extends MacroUtils { private def PropsChildren: Tree = q"_root_.japgolly.scalajs.react.PropsChildren" private def React : Tree = q"_root_.japgolly.scalajs.react.facade.React" private def ScalaFn : Tree = q"_root_.japgolly.scalajs.react.component.ScalaFn" + private def SJS : Tree = q"_root_.scala.scalajs.js" private final class HookMacrosImpl extends AbstractHookMacros { import AbstractHookMacros._ @@ -69,7 +71,7 @@ class HookMacros(val c: Context) extends MacroUtils { override protected def Expr [A] = identity override protected def isUnit = _.tpe == unitType override protected def refToTerm = Ident(_) - override protected def showCode = c.universe.showCode(_) + override def showCode = c.universe.showCode(_).replace("_root_.", "").replace(".`package`.", ".") override protected def showRaw = c.universe.showRaw(_) override protected def Type [A] = _.tpe override protected def typeOfTerm = t => c.universe.TypeTree(t.tpe) @@ -160,18 +162,35 @@ class HookMacros(val c: Context) extends MacroUtils { } } + protected lazy val debugLog = MacroLogger(true) + override protected def custom[I, O] = (_, _, hook, i) => q"$hook.unsafeInit($i)" override protected def customArg[Ctx, Arg] = (_, _, hookArg, ctx) => q"$hookArg.convert($ctx)" + override protected def hookDepsEmptyArray = + q"new $SJS.Array[Any]" + override protected def hooksVar[A] = (_, body) => q"$Hooks.Var($body)" override protected def scalaFn0[A] = (_, body) => q"() => $body" + override protected def useCallback[F <: js.Function] = (f, deps, _) => + q"$React.useCallback($f, $deps)" + + override protected def useCallbackArgFromJs[A, J <: js.Function] = (x, j, _, _) => + q"$x.fromJs($j)" + + override protected def useCallbackArgToJs[A, J <: js.Function] = (x, a, _, _) => + q"$x.toJs($a)" + + override protected def useCallbackArgTypeJs[A, J <: js.Function] = _ => + null // Not used in Scala 2 (i.e. in useCallbackArg{From,To}Js) + override protected def useStateFn[S] = (tpe, body) => q"$React.useStateFn(() => $Box[$tpe]($body))" @@ -248,7 +267,7 @@ class HookMacros(val c: Context) extends MacroUtils { onFailure(err.getMessage()) } - log.footer(showCode(result)) + log.footer(hookMacros.showCode(result)) result } } diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala index 708768f36..6db747499 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala @@ -134,12 +134,19 @@ object HookMacros { implicit val q: Quotes import q.reflect.* + import scala.quoted.{Type => Tpe} + + // TODO: Move into microlibs + extension (self: q.reflect.TypeTree) { + def asTypeOf[A]: Tpe[A] = + self.asType.asInstanceOf[Tpe[A]] + } override type Expr[A] = scala.quoted.Expr[A] override type Ref = UntypedValDef.WithQuotes[q.type] override type Stmt = q.reflect.Statement override type Term = q.reflect.Term - override type Type[A] = scala.quoted.Type[A] + override type Type[A] = Tpe[A] override type TypeTree = q.reflect.TypeTree override protected def asTerm [A] = _.asTerm @@ -150,7 +157,7 @@ object HookMacros { override protected def typeOfTerm = _.tpe.asTypeTree override protected def uninline = _uninline override protected def unitTerm = '{ () } - override protected def unitType = scala.quoted.Type.of[Unit] + override protected def unitType = Tpe.of[Unit] override protected def wrap = (s, b) => Block(s.toList, b) // TODO: Move into microlibs (and make tailrec and non-recursive versions) @@ -184,10 +191,8 @@ object HookMacros { case _ => false } - override protected def Type[A] = t => { - val x: scala.quoted.Type[?] = t.asType - x.asInstanceOf[scala.quoted.Type[A]] - } + override protected def Type[A] = + _.asTypeOf[A] override protected val rewriterBridge: RewriterBridge = HookRewriter.Bridge[Stmt, Term, Ref]( @@ -272,12 +277,27 @@ object HookMacros { override protected def customArg[Ctx, Arg] = implicit (tc, ta, hookArg, ctx) => '{ $hookArg.convert($ctx) } + override protected def hookDepsEmptyArray = + '{ new js.Array[Any] } + override protected def hooksVar[A] = implicit (tpe, body) => '{ Hooks.Var[$tpe]($body) } override protected def scalaFn0[A] = implicit (tpe, body) => '{ () => $body } + override protected def useCallback[F <: js.Function] = implicit (f, deps, tpe) => + '{ React.useCallback($f, $deps) } + + override protected def useCallbackArgFromJs[A, J <: js.Function] = implicit (x, j, ta, tj) => + '{ $x.fromJs($j) } + + override protected def useCallbackArgToJs[A, J <: js.Function] = implicit (x, a, ta, tj) => + '{ $x.toJs($a) } + + override protected def useCallbackArgTypeJs[A, J <: js.Function] = x => + TypeSelect(x.asTerm, "J").asTypeOf[J] + override protected def useStateFn[S] = implicit (tpe, body) => '{ React.useStateFn(() => Box[$tpe]($body)) } diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala index ea96c3355..5e92f84fb 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala @@ -1,12 +1,14 @@ package japgolly.scalajs.react.hooks -import japgolly.scalajs.react.Reusability import japgolly.scalajs.react.facade.React +import japgolly.scalajs.react.facade.React.HookDeps import japgolly.scalajs.react.hooks.Hooks import japgolly.scalajs.react.internal.{Box, MacroLogger} import japgolly.scalajs.react.vdom.VdomNode +import japgolly.scalajs.react.{Reusability, Reusable} import scala.annotation.{nowarn, tailrec} import scala.reflect.ClassTag +import scala.scalajs.js /* Coverage * ======== @@ -204,15 +206,6 @@ trait AbstractHookMacros { protected def wrap : (Vector[Stmt], Term) => Term protected val rewriterBridge: RewriterBridge - protected def custom[I, O]: (Type[I], Type[O], Expr[CustomHook[I, O]], Expr[I]) => Expr[O] - protected def customArg[C, A]: (Type[C], Type[A], Expr[CustomHook.Arg[C, A]], Expr[C]) => Expr[A] - protected def hooksVar[A]: (Type[A], Expr[A]) => Expr[Hooks.Var[A]] - protected def scalaFn0[A]: (Type[A], Expr[A]) => Expr[() => A] - protected def useStateFn[S]: (Type[S], Expr[S]) => Expr[React.UseState[Box[S]]] - protected def useStateFromJsBoxed[S]: (Type[S], Expr[React.UseState[Box[S]]]) => Expr[Hooks.UseState[S]] - protected def useStateWithReuseFromJsBoxed[S]: (Type[S], Expr[React.UseState[Box[S]]], Expr[Reusability[S]], Expr[ClassTag[S]]) => Expr[Hooks.UseStateWithReuse[S]] - protected def vdomRawNode: Expr[VdomNode] => Expr[React.Node] - // ------------------------------------------------------------------------------------------------------------------- // Concrete @@ -393,6 +386,18 @@ trait AbstractHookMacros { b.createHook(withCtx(valueFn), discard = isUnit(tpe)) } + case "useCallback" | "useCallbackBy" => + val (List(tpeC), List(List(callbackFn), List(ucArg, _))) = step.sig : @nowarn + maybeBy(callbackFn) { (b, withCtx) => + val a = refToTerm(b.valDef(ucArg, "_arg")) // stablise for dependent types + type J = js.Function + val tpeJ = useCallbackArgTypeJs[X, J](a) + val callback = withCtx(callbackFn) + val jsCallback = useCallbackArgToJs[X, J](a, callback, tpeC, tpeJ) + val raw = b.createRaw(useCallback[J](jsCallback, hookDepsEmptyArray, tpeJ)) + b.createHook(useCallbackArgFromJs[X, J](a, raw, tpeC, tpeJ)) + } + // case "useMemo" | "useMemoBy" => // val (List(d, a), List(List(deps), List(create), List(reuse, step))) = step.sig : @nowarn // maybeBy(deps) { (b, withCtx) => @@ -417,6 +422,32 @@ trait AbstractHookMacros { } } + protected def custom[I, O]: (Type[I], Type[O], Expr[CustomHook[I, O]], Expr[I]) => Expr[O] + + protected def customArg[C, A]: (Type[C], Type[A], Expr[CustomHook.Arg[C, A]], Expr[C]) => Expr[A] + + protected def hookDepsEmptyArray: Expr[HookDeps] + + protected def hooksVar[A]: (Type[A], Expr[A]) => Expr[Hooks.Var[A]] + + protected def scalaFn0[A]: (Type[A], Expr[A]) => Expr[() => A] + + protected def useCallback[F <: js.Function]: (Expr[F], Expr[HookDeps], Type[F]) => Expr[F] + + protected def useCallbackArgFromJs[A, J <: js.Function]: (Expr[Hooks.UseCallbackArg.To[A, J]], Expr[J], Type[A], Type[J]) => Expr[Reusable[A]] + + protected def useCallbackArgToJs[A, J <: js.Function]: (Expr[Hooks.UseCallbackArg.To[A, J]], Expr[A], Type[A], Type[J]) => Expr[J] + + protected def useCallbackArgTypeJs[A, J <: js.Function]: (Expr[Hooks.UseCallbackArg.To[A, J]]) => Type[J] + + protected def useStateFn[S]: (Type[S], Expr[S]) => Expr[React.UseState[Box[S]]] + + protected def useStateFromJsBoxed[S]: (Type[S], Expr[React.UseState[Box[S]]]) => Expr[Hooks.UseState[S]] + + protected def useStateWithReuseFromJsBoxed[S]: (Type[S], Expr[React.UseState[Box[S]]], Expr[Reusability[S]], Expr[ClassTag[S]]) => Expr[Hooks.UseStateWithReuse[S]] + + protected def vdomRawNode: Expr[VdomNode] => Expr[React.Node] + // ------------------------------------------------------------------------------------------------------------------- def rewriteRender(step: HookStep): Either[() => String, Rewriter => Term] = { log("rewriteRender:" + step.name, step) diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Hooks.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Hooks.scala index 9f505c7d4..9ee7328bc 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Hooks.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Hooks.scala @@ -15,16 +15,18 @@ import scala.scalajs.js.| object Hooks { - trait UseCallbackArg[S] { + trait UseCallbackArg[A] { type J <: js.Function - def toJs: S => J - def fromJs: J => Reusable[S] + def toJs: A => J + def fromJs: J => Reusable[A] } object UseCallbackArg extends UseCallbackArgInstances { - def apply[S, F <: js.Function](f: S => F)(g: F => Reusable[S]): UseCallbackArg[S] = - new UseCallbackArg[S] { + type To[A, F <: js.Function] = UseCallbackArg[A] { type J = F } + + def apply[A, F <: js.Function](f: A => F)(g: F => Reusable[A]): UseCallbackArg[A] = + new UseCallbackArg[A] { override type J = F override def toJs = f override def fromJs = g diff --git a/library/facadeMain/src/main/scala/japgolly/scalajs/react/facade/Hooks.scala b/library/facadeMain/src/main/scala/japgolly/scalajs/react/facade/Hooks.scala index 331abcc10..68811780b 100644 --- a/library/facadeMain/src/main/scala/japgolly/scalajs/react/facade/Hooks.scala +++ b/library/facadeMain/src/main/scala/japgolly/scalajs/react/facade/Hooks.scala @@ -30,10 +30,10 @@ trait Hooks extends js.Object { final type UseEffectArg = js.Function0[js.UndefOr[js.Function0[Any]]] final def useEffect(effect: UseEffectArg, - deps : js.UndefOr[HookDeps] = js.native): Unit = js.native + deps : HookDeps = js.native): Unit = js.native final def useLayoutEffect(effect: js.Function0[js.UndefOr[js.Function0[Any]]], - deps : js.UndefOr[HookDeps] = js.native): Unit = js.native + deps : HookDeps = js.native): Unit = js.native final def useContext[A](ctx: React.Context[A]): A = js.native @@ -42,16 +42,16 @@ trait Hooks extends js.Object { final def useReducer[ S, A](reducer: js.Function2[S, A, S], initialState: S ): UseReducer[S, A] = js.native final def useReducer[I, S, A](reducer: js.Function2[S, A, S], initialArg: I, init: js.Function1[I, S]): UseReducer[S, A] = js.native - final def useCallback[F <: js.Function](callback: F, deps: js.UndefOr[HookDeps] = js.native): F = js.native + final def useCallback[F <: js.Function](callback: F, deps: HookDeps = js.native): F = js.native - final def useMemo[A](f: js.Function0[A], deps: js.UndefOr[HookDeps] = js.native): A = js.native + final def useMemo[A](f: js.Function0[A], deps: HookDeps = js.native): A = js.native final def useRef[A](f: A): React.RefHandle[A] = js.native final def useImperativeHandle[A]( ref : React.RefHandle[A | Null] | ((A | Null) => Any) | Null | Unit, create: js.Function0[A], - deps : js.UndefOr[HookDeps] = js.native): Unit = js.native + deps : HookDeps = js.native): Unit = js.native final def useDebugValue(desc: Any): Unit = js.native final def useDebugValue[A](value: A, desc: A => Any): Unit = js.native diff --git a/library/mktmp b/library/mktmp new file mode 100755 index 000000000..d20f840e9 --- /dev/null +++ b/library/mktmp @@ -0,0 +1,65 @@ +#!/bin/bash + +# TODO: REMEMBER TO DELETE THIS +# TODO: REMEMBER TO DELETE THIS +# TODO: REMEMBER TO DELETE THIS +# TODO: REMEMBER TO DELETE THIS +# TODO: REMEMBER TO DELETE THIS + +cd "$(dirname "$0")" + +function create { + m=$1 + t="$2" + + d=$m/src/test/scala + mkdir -p $d + f=$d/TEMP.scala + [ -e $f ] || (echo "$t" > $f) + ls -l $f +} + +# ====================================================================================================================== + +create coreGeneric 'import japgolly.scalajs.react._ +import japgolly.scalajs.react.component.{ScalaFn => ScalaFnComponent} +import japgolly.scalajs.react.vdom.html_<^._ + +object TEMP { + + final case class PI(pi: Int) { + def unary_- : PI = PI(-pi) + def *(n: Int): PI = PI(pi * n) + def +(n: Int): PI = PI(pi + n) + def +(n: PI): PI = PI(pi + n.pi) + } + +} +' + +# ====================================================================================================================== + +create coreBundleCallback 'import japgolly.scalajs.react._ +import japgolly.scalajs.react.vdom.html_<^._ + +object TEMP { + + final class Counter { + var value = 0 + def inc(by: Int = 1): Int = { + value += by + value + } + def incCB : Callback = incCB(1) + def incCB(by: Int): Callback = Callback{ inc(by); () } + } + + final case class PI(pi: Int) { + def unary_- : PI = PI(-pi) + def *(n: Int): PI = PI(pi * n) + def +(n: Int): PI = PI(pi + n) + def +(n: PI): PI = PI(pi + n.pi) + } + +} +' diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala index f284b3b2f..04d97c370 100644 --- a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala @@ -23,6 +23,7 @@ object Main { HooksWithScalaFns .Component(0), JustPropsChildrenViaHookApi.Component(0)(<.div), JustPropsViaHookApi .Component(0), + UseCallback .Component(0), UseState .Component(0), UseStateWithReuse .Component(0), ) diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseCallback.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseCallback.scala new file mode 100644 index 000000000..e5f25694d --- /dev/null +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseCallback.scala @@ -0,0 +1,20 @@ +package japgolly.scalajs.react.test.emissions + +import japgolly.scalajs.react._ +import japgolly.scalajs.react.vdom.html_<^._ + +object UseCallback { + + val Component = ScalaFnComponent.withHooks[Int] + + .useCallback(Callback.log("aaaaaaaaaaaaaa")) + .useCallbackBy($ => Callback.log("bbbbbbbbbbbbbb" + $.props)) + .useCallbackBy((p, _, _) => Callback.log("cccccccccccccc" + p)) + + .renderRR { (p, a, b, c) => + a.runNow() + b.runNow() + c.runNow() + p + } +} diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseCallback-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseCallback-out2.js new file mode 100644 index 000000000..4ebf0b50d --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseCallback-out2.js @@ -0,0 +1,95 @@ +'use strict'; + +var _s = $RefreshSig$(); + +import * as $i_react from "react"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusable from "./japgolly.scalajs.react.Reusable.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusable$0024 from "./japgolly.scalajs.react.Reusable$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024 from "./japgolly.scalajs.react.callback.Trampoline$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseCallbackArg$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 from "./japgolly.scalajs.react.internal.Singleton$.js"; +import * as $j_japgolly$002escalajs$002ereact$002epackage$0024 from "./japgolly.scalajs.react.package$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024 from "./japgolly.scalajs.react.util.EffectCallback$callback$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; + +function $c_Ljapgolly_scalajs_react_test_emissions_UseCallback$() { + this.Ljapgolly_scalajs_react_test_emissions_UseCallback$__f_Component = null; + $n_Ljapgolly_scalajs_react_test_emissions_UseCallback$ = this; + + var rawComponent = arg1$2 => $m_Ljapgolly_scalajs_react_test_emissions_UseCallback$().japgolly$scalajs$react$test$emissions$UseCallback$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2); + + var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$(), null)); + this.Ljapgolly_scalajs_react_test_emissions_UseCallback$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$1.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_UseCallback$ }; +$c_Ljapgolly_scalajs_react_test_emissions_UseCallback$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_UseCallback$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_UseCallback$; + +function $h_Ljapgolly_scalajs_react_test_emissions_UseCallback$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_UseCallback$ }; +$h_Ljapgolly_scalajs_react_test_emissions_UseCallback$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_UseCallback$.prototype; +$c_Ljapgolly_scalajs_react_test_emissions_UseCallback$.prototype.japgolly$scalajs$react$test$emissions$UseCallback$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s(function (props) { + _s(); + + var hook1_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$().callback__Ljapgolly_scalajs_react_util_Effect$Dispatch__Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); + var $$x2 = $i_react; + var $$x1 = hook1_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_f$1.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline("aaaaaaaaaaaaaa", $j_java$002elang$002eCharacter$0024.$m_sci_Nil$()))); + var a = []; + var hook1_raw = $$x2.useCallback($$x1, a); + var hook1 = hook1_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_g$1.apply__O__O(hook1_raw); + var props$1 = props.a; + var hook2_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$().callback__Ljapgolly_scalajs_react_util_Effect$Dispatch__Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); + var $$x4 = $i_react; + var $$x3 = hook2_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_f$1.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline("bbbbbbbbbbbbbb" + props$1, $j_java$002elang$002eCharacter$0024.$m_sci_Nil$()))); + var a$1 = []; + var hook2_raw = $$x4.useCallback($$x3, a$1); + var hook2 = hook2_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_g$1.apply__O__O(hook2_raw); + var hook3_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$().callback__Ljapgolly_scalajs_react_util_Effect$Dispatch__Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); + var $$x6 = $i_react; + var $$x5 = hook3_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_f$1.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline("cccccccccccccc" + props.a, $j_java$002elang$002eCharacter$0024.$m_sci_Nil$()))); + var a$2 = []; + var hook3_raw = $$x6.useCallback($$x5, a$2); + var hook3 = hook3_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_g$1.apply__O__O(hook3_raw); + var this$ = ($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), hook1.value__O()).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline; + $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$().run__Ljapgolly_scalajs_react_callback_Trampoline__O(this$); + var this$$1 = ($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), hook2.value__O()).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline; + $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$().run__Ljapgolly_scalajs_react_callback_Trampoline__O(this$$1); + var this$$2 = ($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), hook3.value__O()).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline; + $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$().run__Ljapgolly_scalajs_react_callback_Trampoline__O(this$$2); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + var v = props.a | 0; + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + return new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(v).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; +}, "PhZdn6j68F7BN76ND1U3bHNThVg="); +var $d_Ljapgolly_scalajs_react_test_emissions_UseCallback$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_UseCallback$: 0 +}, false, "japgolly.scalajs.react.test.emissions.UseCallback$", { + Ljapgolly_scalajs_react_test_emissions_UseCallback$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_UseCallback$ }; +$c_Ljapgolly_scalajs_react_test_emissions_UseCallback$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_UseCallback$; +var $n_Ljapgolly_scalajs_react_test_emissions_UseCallback$; + +function $m_Ljapgolly_scalajs_react_test_emissions_UseCallback$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_UseCallback$) { + $n_Ljapgolly_scalajs_react_test_emissions_UseCallback$ = new $c_Ljapgolly_scalajs_react_test_emissions_UseCallback$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_UseCallback$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_UseCallback$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseCallback-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseCallback-out3.js new file mode 100644 index 000000000..7cc363d47 --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseCallback-out3.js @@ -0,0 +1,113 @@ +'use strict'; + +import * as $i_react from "react"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusable from "./japgolly.scalajs.react.Reusable.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusable$0024 from "./japgolly.scalajs.react.Reusable$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024 from "./japgolly.scalajs.react.callback.Trampoline$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay from "./japgolly.scalajs.react.callback.Trampoline$Delay.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseCallbackArg$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024 from "./japgolly.scalajs.react.util.EffectCallback$callback$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; +import * as $j_scala$002escalajs$002eruntime$002eCompat$0024 from "./scala.scalajs.runtime.Compat$.js"; + +function $c_Ljapgolly_scalajs_react_test_emissions_UseCallback$() { + var _s = $RefreshSig$(); + + this.Ljapgolly_scalajs_react_test_emissions_UseCallback$__f_Component = null; + $n_Ljapgolly_scalajs_react_test_emissions_UseCallback$ = this; + + var rawComponent = props => { + _s(); + + var hook1_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$().callback__Ljapgolly_scalajs_react_util_Effect$Dispatch__Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); + var $$x2 = $i_react; + var $$x1 = hook1_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_f$1; + var optionalParams$proxy1 = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); + var f$proxy3 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((optionalParams$proxy1$2 => () => { + console.log("aaaaaaaaaaaaaa", ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy1$2)); + })(optionalParams$proxy1)); + var hook1_raw = $$x2.useCallback($$x1.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy3)))), []); + var hook1 = hook1_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_g$1.apply__O__O(hook1_raw); + var props$1 = props.a; + var hook2_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$().callback__Ljapgolly_scalajs_react_util_Effect$Dispatch__Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); + var $$x4 = $i_react; + var $$x3 = hook2_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_f$1; + var message$proxy1 = "bbbbbbbbbbbbbb" + props$1; + var optionalParams$proxy2 = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); + var f$proxy6 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((message$proxy1$2, optionalParams$proxy2$2) => () => { + console.log(message$proxy1$2, ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy2$2)); + })(message$proxy1, optionalParams$proxy2)); + var hook2_raw = $$x4.useCallback($$x3.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy6)))), []); + var hook2 = hook2_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_g$1.apply__O__O(hook2_raw); + var hook3_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$().callback__Ljapgolly_scalajs_react_util_Effect$Dispatch__Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); + var $$x6 = $i_react; + var $$x5 = hook3_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_f$1; + var p = props.a | 0; + var message$proxy2 = "cccccccccccccc" + p; + var optionalParams$proxy3 = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); + var f$proxy9 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((message$proxy2$2, optionalParams$proxy3$2) => () => { + console.log(message$proxy2$2, ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy3$2)); + })(message$proxy2, optionalParams$proxy3)); + var hook3_raw = $$x6.useCallback($$x5.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy9)))), []); + var hook3 = hook3_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_g$1.apply__O__O(hook3_raw); + var p$2 = props.a | 0; + $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); + var ev$1 = hook1.value__O(); + var CallbackTo_this = ev$1 === null ? null : ev$1.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline; + $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$().run__Ljapgolly_scalajs_react_callback_Trampoline__O(CallbackTo_this); + $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); + var ev$2 = hook2.value__O(); + var CallbackTo_this$2 = ev$2 === null ? null : ev$2.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline; + $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$().run__Ljapgolly_scalajs_react_callback_Trampoline__O(CallbackTo_this$2); + $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); + var ev$3 = hook3.value__O(); + var CallbackTo_this$3 = ev$3 === null ? null : ev$3.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline; + $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$().run__Ljapgolly_scalajs_react_callback_Trampoline__O(CallbackTo_this$3); + return ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(p$2)).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; + }; + + _s(rawComponent, "PhZdn6j68F7BN76ND1U3bHNThVg="); + + var $$x7 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$21 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); + this.Ljapgolly_scalajs_react_test_emissions_UseCallback$__f_Component = $$x7.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$21.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_UseCallback$ }; +$c_Ljapgolly_scalajs_react_test_emissions_UseCallback$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_UseCallback$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_UseCallback$; + +function $h_Ljapgolly_scalajs_react_test_emissions_UseCallback$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_UseCallback$ }; +$h_Ljapgolly_scalajs_react_test_emissions_UseCallback$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_UseCallback$.prototype; +var $d_Ljapgolly_scalajs_react_test_emissions_UseCallback$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_UseCallback$: 0 +}, false, "japgolly.scalajs.react.test.emissions.UseCallback$", { + Ljapgolly_scalajs_react_test_emissions_UseCallback$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_UseCallback$ }; +$c_Ljapgolly_scalajs_react_test_emissions_UseCallback$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_UseCallback$; +var $n_Ljapgolly_scalajs_react_test_emissions_UseCallback$; + +function $m_Ljapgolly_scalajs_react_test_emissions_UseCallback$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_UseCallback$) { + $n_Ljapgolly_scalajs_react_test_emissions_UseCallback$ = new $c_Ljapgolly_scalajs_react_test_emissions_UseCallback$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_UseCallback$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_UseCallback$ }; diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala index ba8d8d329..91cef9f18 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala @@ -33,6 +33,7 @@ object ReactRefreshTest extends TestSuite { "HooksWithScalaFns" - testScala() "JustPropsChildrenViaHookApi" - testScala(assertRR = false) // TODO: "JustPropsViaHookApi" - testScala(assertRR = false) // TODO: + "UseCallback" - testScala() "UseState" - testScala() "UseStateWithReuse" - testScala() } From 8298460b19f3e0ad0728a2ac9f4f4be8107dc6a2 Mon Sep 17 00:00:00 2001 From: David Barri Date: Tue, 21 Jun 2022 15:32:40 +1000 Subject: [PATCH 57/72] Rename last context object to `render_ctx` --- .../react/hooks/AbstractHookMacros.scala | 36 ++++++++++++++----- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala index 5e92f84fb..c32a22505 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala @@ -65,7 +65,10 @@ object AbstractHookMacros { // Don't make this an eager val. It depends on `val hookNo` protected def hookName = - "hook" + hookNo + if (hookNo < 0) + "render" + else + "hook" + hookNo final def +=(stmt: Stmt): Unit = _stmts :+= stmt @@ -93,15 +96,19 @@ object AbstractHookMacros { bridge.refToTerm(ctx) } - final def createHook(body: Term): Ref = + final def createHook(body: Term): Ref = { + assert(hookNo > 0) valDef(body, "") + } - final def createHook(body: Term, discard: Boolean): Option[Ref] = + final def createHook(body: Term, discard: Boolean): Option[Ref] = { + assert(hookNo > 0) if (discard) { this += body None } else Some(createHook(body)) + } final def createRaw(body: Term, isLazy: Boolean = false): Ref = valDef(body, "_raw", isLazy = isLazy) @@ -134,9 +141,9 @@ object AbstractHookMacros { @inline def isScala3 = scalaVer == 3 } - def init[Stmt, Term <: Stmt, Ref](ctx : InitialCtx[Stmt, Term], - bridg : Bridge[Stmt, Term, Ref], - useChildren: Boolean): HookRewriter[Stmt, Term, Ref] = + def start[Stmt, Term <: Stmt, Ref](ctx : InitialCtx[Stmt, Term], + bridg : Bridge[Stmt, Term, Ref], + useChildren: Boolean): HookRewriter[Stmt, Term, Ref] = new HookRewriter[Stmt, Term, Ref] { override val bridge = bridg override protected val hookNo = 1 @@ -155,6 +162,16 @@ object AbstractHookMacros { override protected val prevHooks = newHook.fold(prev.prevHooks)(prev.prevHooks :+ prev.bridge.refToTerm(_)) override protected val usesChildren = prev.usesChildren } + + def end[Stmt, Term <: Stmt, Ref](prev: HookRewriter[Stmt, Term, Ref]): HookRewriter[Stmt, Term, Ref] = + new HookRewriter[Stmt, Term, Ref] { + override val bridge = prev.bridge + override protected val hookNo = -1 + override protected val initialCtx = prev.initialCtx + override protected def initialStmts = prev.stmts() + override protected val prevHooks = prev.prevHooks + override protected val usesChildren = prev.usesChildren + } } } @@ -295,12 +312,13 @@ trait AbstractHookMacros { hookFns <- traverseVector(hookSteps)(rewriteStep) renderFn <- rewriteRender(renderStep) } yield rctx => { - val r0 = HookRewriter.init(rctx, rewriterBridge, withPropsChildren) + val r0 = HookRewriter.start(rctx, rewriterBridge, withPropsChildren) val rH = hookFns.foldLeft(r0)((r, hf) => HookRewriter.next(r)(hf(r))) - val vdom = renderFn(rH) + val rR = HookRewriter.end(rH) + val vdom = renderFn(rR) import AutoTypeImplicits._ - wrap(rH.stmts(), vdomRawNode(vdom)) + wrap(rR.stmts(), vdomRawNode(vdom)) } } From 55723b71e0b8d6a8d661a0733d16189010c4f78a Mon Sep 17 00:00:00 2001 From: David Barri Date: Tue, 21 Jun 2022 17:26:31 +1000 Subject: [PATCH 58/72] Support `useCallbackWithDeps*` --- library/TODO.md | 8 --- .../scalajs/react/hooks/HookMacros.scala | 30 ++++++++- .../scalajs/react/hooks/HookMacros.scala | 36 +++++++++-- .../react/hooks/AbstractHookMacros.scala | 64 +++++++++++++++---- .../scalajs/react/hooks/CustomHook.scala | 52 +++++++-------- .../test/resources/rr-sjr/UseCallback-out2.js | 18 +++--- .../test/resources/rr-sjr/UseCallback-out3.js | 20 +++--- .../emissions/util/MutableVirtualFile.scala | 4 +- .../react/test/emissions/util/TestJs.scala | 2 +- .../react/test/emissions/util/Util.scala | 56 ++++++++-------- 10 files changed, 192 insertions(+), 98 deletions(-) diff --git a/library/TODO.md b/library/TODO.md index aac69d5fd..548180215 100644 --- a/library/TODO.md +++ b/library/TODO.md @@ -1,14 +1,6 @@ ```scala // Api.scala -def useCallback [A](callback: A)(implicit a: UseCallbackArg[A], step: Step): step.Next[Reusable[A]] -def useCallbackBy [A](callback: Ctx => A)(implicit a: UseCallbackArg[A], step: Step): step.Next[Reusable[A]] -def useCallbackBy [A](callback: CtxFn[A])(implicit a: UseCallbackArg[A], step: Step): step.Next[Reusable[A]] - -def useCallbackWithDeps [D, A](deps: => D)(callback: D => A)(implicit a: UseCallbackArg[A], r: Reusability[D], step: Step): step.Next[Reusable[A]] -def useCallbackWithDepsBy [D, A](deps: Ctx => D)(callback: Ctx => D => A)(implicit a: UseCallbackArg[A], r: Reusability[D], step: Step): step.Next[Reusable[A]] -def useCallbackWithDepsBy [D, A](deps: CtxFn[D])(callback: CtxFn[D => A])(implicit a: UseCallbackArg[A], r: Reusability[D], step: Step): step.Next[Reusable[A]] - def useContext [A](ctx: Context[A])(implicit step: Step): step.Next[A] def useContextBy [A](f: Ctx => Context[A])(implicit step: Step): step.Next[A] def useContextBy [A](f: CtxFn[Context[A]])(implicit step: Step): step.Next[A] diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala index b9367be8e..af4ac1b99 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -3,6 +3,7 @@ package japgolly.scalajs.react.hooks import japgolly.microlibs.compiletime.MacroUtils import japgolly.scalajs.react.Children import japgolly.scalajs.react.hooks.Api._ +import japgolly.scalajs.react.hooks.CustomHook.ReusableDepState import japgolly.scalajs.react.internal.{Box, MacroLogger} import scala.reflect.macros.blackbox.Context import scala.scalajs.js @@ -49,6 +50,7 @@ class HookMacros(val c: Context) extends MacroUtils { private def Box : Tree = q"_root_.japgolly.scalajs.react.internal.Box" private def Box(t: Type) : Type = appliedType(c.typeOf[Box[_]], t) + private def CustomHook : Tree = q"_root_.japgolly.scalajs.react.hooks.CustomHook" private def HookCtx : Tree = q"_root_.japgolly.scalajs.react.hooks.HookCtx" private def Hooks : Tree = q"_root_.japgolly.scalajs.react.hooks.Hooks" private def JsFn : Tree = q"_root_.japgolly.scalajs.react.component.JsFn" @@ -60,7 +62,7 @@ class HookMacros(val c: Context) extends MacroUtils { private final class HookMacrosImpl extends AbstractHookMacros { import AbstractHookMacros._ - override type Expr[A] = Term + override type Expr[+A] = Term override type Ref = TermName override type Stmt = c.universe.Tree override type Term = c.universe.Tree @@ -171,11 +173,32 @@ class HookMacros(val c: Context) extends MacroUtils { q"$hookArg.convert($ctx)" override protected def hookDepsEmptyArray = - q"new $SJS.Array[Any]" + q"$SJS.Array[Any]()" + + override protected def hookDepsIntArray1 = i => + q"$SJS.Array[Int]($i)" override protected def hooksVar[A] = (_, body) => q"$Hooks.Var($body)" + override protected def none[A] = _ => + q"None" + + override protected def optionType[A] = a => + appliedType(c.typeOf[Option[_]], a) + + override protected def reusableDepsLogic[D] = (d, s, r, tpeD) => + q"$CustomHook.reusableDepsLogic[$tpeD]($d)($s)($r)" + + override protected def reusableDepStateRev = rds => + q"$rds.rev" + + override protected def reusableDepStateType[D] = d => + appliedType(c.typeOf[ReusableDepState[_]], d) + + override protected def reusableDepStateValue[D] = (rds, _) => + q"$rds.value" + override protected def scalaFn0[A] = (_, body) => q"() => $body" @@ -194,6 +217,9 @@ class HookMacros(val c: Context) extends MacroUtils { override protected def useStateFn[S] = (tpe, body) => q"$React.useStateFn(() => $Box[$tpe]($body))" + override protected def useStateValue[S] = (tpe, body) => + q"$React.useStateValue($Box[$tpe]($body))" + override protected def useStateFromJsBoxed[S] = (tpe, raw) => q"$Hooks.UseState.fromJsBoxed[$tpe]($raw)" diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala index 6db747499..76a081986 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala @@ -7,6 +7,8 @@ import japgolly.scalajs.react.component.ScalaFn.Component import japgolly.scalajs.react.facade import japgolly.scalajs.react.facade.React import japgolly.scalajs.react.hooks.Api.* +import japgolly.scalajs.react.hooks.CustomHook +import japgolly.scalajs.react.hooks.CustomHook.ReusableDepState import japgolly.scalajs.react.hooks.HookCtx import japgolly.scalajs.react.internal.{Box, MacroLogger} import japgolly.scalajs.react.vdom.VdomNode @@ -142,7 +144,7 @@ object HookMacros { self.asType.asInstanceOf[Tpe[A]] } - override type Expr[A] = scala.quoted.Expr[A] + override type Expr[+A] = scala.quoted.Expr[A] override type Ref = UntypedValDef.WithQuotes[q.type] override type Stmt = q.reflect.Statement override type Term = q.reflect.Term @@ -152,7 +154,7 @@ object HookMacros { override protected def asTerm [A] = _.asTerm override protected def Expr [A] = _.asExprOf[Any].asInstanceOf[Expr[A]] override protected def refToTerm = _.ref - override protected def showCode = _.show(using q.reflect.Printer.TreeShortCode) + override def showCode = _.show(using q.reflect.Printer.TreeShortCode) override protected def showRaw = _.show(using q.reflect.Printer.TreeStructure) override protected def typeOfTerm = _.tpe.asTypeTree override protected def uninline = _uninline @@ -278,11 +280,34 @@ object HookMacros { '{ $hookArg.convert($ctx) } override protected def hookDepsEmptyArray = - '{ new js.Array[Any] } + '{ js.Array[Any]() } + + override protected def hookDepsIntArray1 = i => + '{ js.Array[Int]($i) } override protected def hooksVar[A] = implicit (tpe, body) => '{ Hooks.Var[$tpe]($body) } + override protected def none[A] = implicit tpe => + '{ None } + + override protected def optionType[A] = { + case '[a] => Tpe.of[Option[a]].asInstanceOf[Type[Option[A]]] + } + + override protected def reusableDepsLogic[D] = implicit (d, s, r, tpeD) => + '{ CustomHook.reusableDepsLogic[D]($d)($s)($r) } + + override protected def reusableDepStateRev = rds => + '{ $rds.rev } + + override protected def reusableDepStateType[D] = { + case '[d] => Tpe.of[ReusableDepState[d]].asInstanceOf[Type[ReusableDepState[D]]] + } + + override protected def reusableDepStateValue[D] = implicit (rds, tpeD) => + '{ $rds.value } + override protected def scalaFn0[A] = implicit (tpe, body) => '{ () => $body } @@ -301,6 +326,9 @@ object HookMacros { override protected def useStateFn[S] = implicit (tpe, body) => '{ React.useStateFn(() => Box[$tpe]($body)) } + override protected def useStateValue[S] = implicit (tpe, body) => + '{ React.useStateValue(Box[$tpe]($body)) } + override protected def useStateFromJsBoxed[S] = implicit (tpe, raw) => '{ Hooks.UseState.fromJsBoxed[$tpe]($raw) } @@ -439,7 +467,7 @@ object HookMacros { onFailure(err.getMessage()) } - log.footer(result.show) + log.footer(hookMacros.showCode(result.asTerm)) result } diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala index c32a22505..9215e5d78 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala @@ -2,6 +2,7 @@ package japgolly.scalajs.react.hooks import japgolly.scalajs.react.facade.React import japgolly.scalajs.react.facade.React.HookDeps +import japgolly.scalajs.react.hooks.CustomHook.ReusableDepState import japgolly.scalajs.react.hooks.Hooks import japgolly.scalajs.react.internal.{Box, MacroLogger} import japgolly.scalajs.react.vdom.VdomNode @@ -180,7 +181,7 @@ object AbstractHookMacros { trait AbstractHookMacros { import AbstractHookMacros.HookRewriter - type Expr[A] + type Expr[+A] type Ref type Stmt type Term <: Stmt @@ -345,12 +346,32 @@ trait AbstractHookMacros { else Right(use(_, identity)) - implicit def autoSomeRefs(r: Ref): Option[Ref] = - Some(r) - import AutoTypeImplicits._ trait X + def createUseCallbackHook[C](b: Rewriter, ucArg: Term, callback: Expr[C], hookDeps: Expr[HookDeps], tpeC: Type[C]): Ref = { + val a = refToTerm(b.valDef(ucArg, "_arg")) // stablise for dependent types + type J = js.Function + val tpeJ = useCallbackArgTypeJs[C, J](a) + val jsCallback = b.valDef(useCallbackArgToJs[C, J](a, callback, tpeC, tpeJ), "_jscb") + val raw = b.createRaw(useCallback[J](jsCallback, hookDeps, tpeJ)) + val hook = useCallbackArgFromJs[C, J](a, raw, tpeC, tpeJ) + b.createHook(hook) + } + + def reusableDeps[D](b: Rewriter, depsExpr: Expr[D], reuse: Expr[Reusability[D]], tpeD: Type[D]): Expr[ReusableDepState[D]] = { + type DS = ReusableDepState[D] + val tpeODS = optionType(reusableDepStateType(tpeD)) + val stateRaw = b.valDef(useStateValue[Option[DS]](tpeODS, none(tpeODS)), "_state_raw") + val state = b.valDef(useStateFromJsBoxed[Option[DS]](tpeODS, stateRaw), "_state") + val deps = b.valDef(depsExpr, "_deps") + val depsState = b.valDef(reusableDepsLogic[D](deps, state, reuse, tpeD), "_deps_state") + depsState + } + + implicit def autoSomeRefs(r: Ref): Option[Ref] = + Some(r) + step.name match { // val (List(), List(List())) = step.sig : @nowarn @@ -407,13 +428,18 @@ trait AbstractHookMacros { case "useCallback" | "useCallbackBy" => val (List(tpeC), List(List(callbackFn), List(ucArg, _))) = step.sig : @nowarn maybeBy(callbackFn) { (b, withCtx) => - val a = refToTerm(b.valDef(ucArg, "_arg")) // stablise for dependent types - type J = js.Function - val tpeJ = useCallbackArgTypeJs[X, J](a) - val callback = withCtx(callbackFn) - val jsCallback = useCallbackArgToJs[X, J](a, callback, tpeC, tpeJ) - val raw = b.createRaw(useCallback[J](jsCallback, hookDepsEmptyArray, tpeJ)) - b.createHook(useCallbackArgFromJs[X, J](a, raw, tpeC, tpeJ)) + createUseCallbackHook[X](b, ucArg, withCtx(callbackFn), hookDepsEmptyArray, tpeC) + } + + case "useCallbackWithDeps" | "useCallbackWithDepsBy" => + val (List(tpeD, tpeC), List(List(depsFn), List(callbackFnFn), List(ucArg, reuse, _))) = step.sig : @nowarn + maybeBy(callbackFnFn) { (b, withCtx) => + val rds = reusableDeps[X](b, withCtx(depsFn), reuse, tpeD) + val deps = reusableDepStateValue(rds, tpeD) + val callbackFn = withCtx(callbackFnFn) + val callback = call(callbackFn, deps :: Nil, false) + val hookDeps = hookDepsIntArray1(reusableDepStateRev(rds)) + createUseCallbackHook[X](b, ucArg, callback, hookDeps, tpeC) } // case "useMemo" | "useMemoBy" => @@ -446,8 +472,22 @@ trait AbstractHookMacros { protected def hookDepsEmptyArray: Expr[HookDeps] + protected def hookDepsIntArray1: Expr[Int] => Expr[HookDeps] + protected def hooksVar[A]: (Type[A], Expr[A]) => Expr[Hooks.Var[A]] + protected def none[A]: Type[Option[A]] => Expr[Option[A]] + + protected def optionType[A]: Type[A] => Type[Option[A]] + + protected def reusableDepsLogic[D]: (Expr[D], Expr[Hooks.UseState[Option[ReusableDepState[D]]]], Expr[Reusability[D]], Type[D]) => Expr[ReusableDepState[D]] + + protected def reusableDepStateRev: Expr[ReusableDepState[Any]] => Expr[Int] + + protected def reusableDepStateType[D]: Type[D] => Type[ReusableDepState[D]] + + protected def reusableDepStateValue[D]: (Expr[ReusableDepState[D]], Type[D]) => Expr[D] + protected def scalaFn0[A]: (Type[A], Expr[A]) => Expr[() => A] protected def useCallback[F <: js.Function]: (Expr[F], Expr[HookDeps], Type[F]) => Expr[F] @@ -460,6 +500,8 @@ trait AbstractHookMacros { protected def useStateFn[S]: (Type[S], Expr[S]) => Expr[React.UseState[Box[S]]] + protected def useStateValue[S]: (Type[S], Expr[S]) => Expr[React.UseState[Box[S]]] + protected def useStateFromJsBoxed[S]: (Type[S], Expr[React.UseState[Box[S]]]) => Expr[Hooks.UseState[S]] protected def useStateWithReuseFromJsBoxed[S]: (Type[S], Expr[React.UseState[Box[S]]], Expr[Reusability[S]], Expr[ClassTag[S]]) => Expr[Hooks.UseStateWithReuse[S]] diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/CustomHook.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/CustomHook.scala index 2b77dd24e..98637ec5a 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/CustomHook.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/CustomHook.scala @@ -170,39 +170,39 @@ object CustomHook { // =================================================================================================================== - private final case class ReusableDepState[+A](value: A, rev: Int) { + final case class ReusableDepState[+A](value: A, rev: Int) { var skipTest = true val asTuple = (value, rev) } + def reusableDepsLogic[D](next: D) + (depsState: Hooks.UseState[Option[ReusableDepState[D]]]) + (implicit r: Reusability[D]): ReusableDepState[D] = + depsState.value match { + + // React is calling us again after the setState below + // Don't re-test reusability, we could end up in an infinite-loop (see #1027) + case Some(s) if s.skipTest => + s.skipTest = false + s + + // Previous result can be reused + case Some(prevState) if r.test(prevState.value, next) => + prevState + + // Not reusable + case o => + val nextRev = o.fold(1)(_.rev + 1) + val nextState = ReusableDepState(next, nextRev) + val updateState = depsState.setState(Some(nextState)) // this causes a hook re-eval + DefaultEffects.Sync.runSync(updateState) + nextState + } + def reusableDeps[D](implicit r: Reusability[D]): CustomHook[() => D, (D, Int)] = CustomHook[() => D] .useState[Option[ReusableDepState[D]]](None) - .buildReturning { (getDeps, depsState) => - val next = getDeps() - val nextDepState = - depsState.value match { - - // React is calling us again after the setState below - // Don't re-test reusability, we could end up in an infinite-loop (see #1027) - case Some(s) if s.skipTest => - s.skipTest = false - s - - // Previous result can be reused - case Some(prevState) if r.test(prevState.value, next) => - prevState - - // Not reusable - case o => - val nextRev = o.fold(1)(_.rev + 1) - val nextState = ReusableDepState(next, nextRev) - val updateState = depsState.setState(Some(nextState)) // this causes a hook re-eval - DefaultEffects.Sync.runSync(updateState) - nextState - } - nextDepState.asTuple - } + .buildReturning((d, s) => reusableDepsLogic(d())(s).asTuple) def reusableByDeps[D, A](create: (D, Int) => A)(implicit r: Reusability[D]): CustomHook[() => D, Reusable[A]] = reusableDeps[D].map { case (d, rev) => Reusable.implicitly(rev).withValue(create(d, rev)) } diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseCallback-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseCallback-out2.js index 4ebf0b50d..0a209611d 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseCallback-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseCallback-out2.js @@ -44,23 +44,23 @@ $c_Ljapgolly_scalajs_react_test_emissions_UseCallback$.prototype.japgolly$scalaj _s(); var hook1_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$().callback__Ljapgolly_scalajs_react_util_Effect$Dispatch__Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); - var $$x2 = $i_react; - var $$x1 = hook1_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_f$1.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline("aaaaaaaaaaaaaa", $j_java$002elang$002eCharacter$0024.$m_sci_Nil$()))); + var hook1_jscb = hook1_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_f$1.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline("aaaaaaaaaaaaaa", $j_java$002elang$002eCharacter$0024.$m_sci_Nil$()))); + var $$x1 = $i_react; var a = []; - var hook1_raw = $$x2.useCallback($$x1, a); + var hook1_raw = $$x1.useCallback(hook1_jscb, a); var hook1 = hook1_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_g$1.apply__O__O(hook1_raw); var props$1 = props.a; var hook2_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$().callback__Ljapgolly_scalajs_react_util_Effect$Dispatch__Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); - var $$x4 = $i_react; - var $$x3 = hook2_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_f$1.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline("bbbbbbbbbbbbbb" + props$1, $j_java$002elang$002eCharacter$0024.$m_sci_Nil$()))); + var hook2_jscb = hook2_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_f$1.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline("bbbbbbbbbbbbbb" + props$1, $j_java$002elang$002eCharacter$0024.$m_sci_Nil$()))); + var $$x2 = $i_react; var a$1 = []; - var hook2_raw = $$x4.useCallback($$x3, a$1); + var hook2_raw = $$x2.useCallback(hook2_jscb, a$1); var hook2 = hook2_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_g$1.apply__O__O(hook2_raw); var hook3_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$().callback__Ljapgolly_scalajs_react_util_Effect$Dispatch__Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); - var $$x6 = $i_react; - var $$x5 = hook3_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_f$1.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline("cccccccccccccc" + props.a, $j_java$002elang$002eCharacter$0024.$m_sci_Nil$()))); + var hook3_jscb = hook3_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_f$1.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline("cccccccccccccc" + props.a, $j_java$002elang$002eCharacter$0024.$m_sci_Nil$()))); + var $$x3 = $i_react; var a$2 = []; - var hook3_raw = $$x6.useCallback($$x5, a$2); + var hook3_raw = $$x3.useCallback(hook3_jscb, a$2); var hook3 = hook3_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_g$1.apply__O__O(hook3_raw); var this$ = ($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), hook1.value__O()).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline; $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$().run__Ljapgolly_scalajs_react_callback_Trampoline__O(this$); diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseCallback-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseCallback-out3.js index 7cc363d47..59ebf85f3 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseCallback-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseCallback-out3.js @@ -29,35 +29,35 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseCallback$() { _s(); var hook1_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$().callback__Ljapgolly_scalajs_react_util_Effect$Dispatch__Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); - var $$x2 = $i_react; var $$x1 = hook1_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_f$1; var optionalParams$proxy1 = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); var f$proxy3 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((optionalParams$proxy1$2 => () => { console.log("aaaaaaaaaaaaaa", ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy1$2)); })(optionalParams$proxy1)); - var hook1_raw = $$x2.useCallback($$x1.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy3)))), []); + var hook1_jscb = $$x1.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy3)))); + var hook1_raw = $i_react.useCallback(hook1_jscb, []); var hook1 = hook1_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_g$1.apply__O__O(hook1_raw); var props$1 = props.a; var hook2_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$().callback__Ljapgolly_scalajs_react_util_Effect$Dispatch__Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); - var $$x4 = $i_react; - var $$x3 = hook2_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_f$1; + var $$x2 = hook2_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_f$1; var message$proxy1 = "bbbbbbbbbbbbbb" + props$1; var optionalParams$proxy2 = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); var f$proxy6 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((message$proxy1$2, optionalParams$proxy2$2) => () => { console.log(message$proxy1$2, ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy2$2)); })(message$proxy1, optionalParams$proxy2)); - var hook2_raw = $$x4.useCallback($$x3.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy6)))), []); + var hook2_jscb = $$x2.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy6)))); + var hook2_raw = $i_react.useCallback(hook2_jscb, []); var hook2 = hook2_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_g$1.apply__O__O(hook2_raw); var hook3_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$().callback__Ljapgolly_scalajs_react_util_Effect$Dispatch__Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); - var $$x6 = $i_react; - var $$x5 = hook3_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_f$1; + var $$x3 = hook3_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_f$1; var p = props.a | 0; var message$proxy2 = "cccccccccccccc" + p; var optionalParams$proxy3 = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); var f$proxy9 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((message$proxy2$2, optionalParams$proxy3$2) => () => { console.log(message$proxy2$2, ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy3$2)); })(message$proxy2, optionalParams$proxy3)); - var hook3_raw = $$x6.useCallback($$x5.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy9)))), []); + var hook3_jscb = $$x3.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy9)))); + var hook3_raw = $i_react.useCallback(hook3_jscb, []); var hook3 = hook3_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_g$1.apply__O__O(hook3_raw); var p$2 = props.a | 0; $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); @@ -77,10 +77,10 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseCallback$() { _s(rawComponent, "PhZdn6j68F7BN76ND1U3bHNThVg="); - var $$x7 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var $$x4 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); var this$21 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); - this.Ljapgolly_scalajs_react_test_emissions_UseCallback$__f_Component = $$x7.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$21.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); + this.Ljapgolly_scalajs_react_test_emissions_UseCallback$__f_Component = $$x4.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$21.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); } export { $c_Ljapgolly_scalajs_react_test_emissions_UseCallback$ }; diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/MutableVirtualFile.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/MutableVirtualFile.scala index 480b1bbeb..0f8e861cc 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/MutableVirtualFile.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/MutableVirtualFile.scala @@ -91,10 +91,10 @@ class MutableVirtualFile(val filenameOption: Option[String], val originalContent set(content.trim + "\n") def descSize(): String = { - val bytes = content.length val total = content.linesIterator.size val nonblank = content.linesIterator.count(_.trim.nonEmpty) - s"$total lines, $nonblank non-blank, $bytes bytes" + val blank = total - nonblank + s"$nonblank non-blank lines, $blank blank lines, $total total" } } diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala index 3e2ec05db..a6cfec0ef 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala @@ -57,7 +57,7 @@ object TestJs { .replace("$less$up", "") .replace("japgolly_scalajs_react_", "sjr_") .replace("japgolly$scalajs$react$", "sjr$") - .replaceAll("\\$\\d+", "\\$0") // change `this$24` etc into just `this$0` + .replaceAll("(\\$(?:\\$x)?)\\d+", "$10") // change `this$24` etc into just `this$0` .replaceAll("scala_scalajs_runtime_(?=AnonFunction|WrappedVarArgs)", "") ) .filterNot(objectInit) diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Util.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Util.scala index 43b9fe1e2..f56e319e2 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Util.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Util.scala @@ -40,37 +40,38 @@ import scala.io.AnsiColor._ import japgolly.microlibs.testutil.TestUtilInternals._ import japgolly.microlibs.testutil.LineDiff println() - val AE = List(actual, expect).map(_.split("\n")) - val List(as, es) = AE : @nowarn - val lim = as.length max es.length - val List(maxAllA,_) = AE.map(x => (0 :: x.iterator.map(_.length).toList).max) : @nowarn - // val mismtachingLines = (as.iterator.zip(es.iterator)).filter { case (a,e) => a !=* e }.toList - // val maxDiffA = (0 :: mismtachingLines.map(_._1.length)).max - // val maxLimitA = 80 - // val maxA = if (maxAllA <= maxLimitA) maxAllA else if (maxLimitA >= maxDiffA) maxLimitA else maxDiffA - val maxLimitA = 100 // TODO: Make configurable by moving into config class + val EA = List(expect, actual).map(_.split("\n")) + val List(es, as) = EA : @nowarn + val lim = es.length max as.length + val List(maxAllE,_) = EA.map(x => (0 :: x.iterator.map(_.length).toList).max) : @nowarn + // val mismtachingLines = (es.iterator.zip(as.iterator)).filter { case (e,a) => e !=* a }.toList + // val maxDiffE = (0 :: mismtachingLines.map(_._1.length)).max + // val maxLimitE = 80 + // val maxE = if (maxAllE <= maxLimitE) maxAllE else if (maxLimitE >= maxDiffE) maxLimitE else maxDiffE + val maxLimitE = 114 // TODO: Make configurable by moving into config class // TODO: Make colours configurable by moving into config class // TODO: Make diffing logic configurable by moving into config class - val maxA = maxAllA min maxLimitA + // TODO: Now I now why I keep finding the colours confusing! diff:red=del,green=add, assert:red=bad,green=good + val maxE = maxAllE min maxLimitE val maxL = lim.toString.length - if (maxL == 0 || maxA == 0) + if (maxL == 0 || maxE == 0) assertEqO(name, actual, expect) else { val nameSuffix = name.fold(RESET)(s":$RESET " + _) - val fmtWSA = RED_B + BLACK val fmtWSE = GREEN_B + BLACK - val fmtKOA = BLACK_B + BOLD_BRIGHT_RED + val fmtWSA = RED_B + BLACK val fmtKOE = BLACK_B + BOLD_BRIGHT_GREEN - val cmp = if (as.length == es.length) "|" else if (as.length > es.length) ">" else "<" - println(s"${BRIGHT_YELLOW}assertMultiline$nameSuffix (${fmtKOA}actual$RESET $cmp ${fmtKOE}expect$RESET)") + val fmtKOA = BLACK_B + BOLD_BRIGHT_RED + val cmp = if (as.length == es.length) "|" else if (es.length > as.length) ">" else "<" + println(s"${BRIGHT_YELLOW}assertMultiline$nameSuffix (${fmtKOE}expect$RESET $cmp ${fmtKOA}actual$RESET)") if (as.length == es.length) { - val fmtOK = s"${BRIGHT_BLACK}%${maxL}d: %-${maxA}s | | %s${RESET}\n" - val fmtWS = s"${WHITE}%${maxL}d: ${fmtWSA}%-${maxA}s${RESET}${WHITE} |≈| ${fmtWSE}%s${RESET}\n" - val fmtKO = s"${WHITE}%${maxL}d: ${fmtKOA}%-${maxA}s${RESET}${WHITE} |≠| ${fmtKOE}%s${RESET}\n" + val fmtOK = s"${BRIGHT_BLACK}%${maxL}d: %-${maxE}s | | %s${RESET}\n" + val fmtWS = s"${WHITE}%${maxL}d: ${fmtWSE}%-${maxE}s${RESET}${WHITE} |≈| ${fmtWSA}%s${RESET}\n" + val fmtKO = s"${WHITE}%${maxL}d: ${fmtKOE}%-${maxE}s${RESET}${WHITE} |≠| ${fmtKOA}%s${RESET}\n" def removeWhitespace(s: String) = s.filterNot(_.isWhitespace) for (i <- 0 until lim) { - val List(a, e) = AE.map(s => if (i >= s.length) "" else s(i)) : @nowarn + val List(e, a) = EA.map(s => if (i >= s.length) "" else s(i)) : @nowarn // val (fmt, a2, e2) = // if (a == e) @@ -90,14 +91,19 @@ import japgolly.microlibs.testutil.LineDiff (fmtKO, false) // TODO: Make `true` configurable by moving into config class val l = i + 1 - val w = maxA - @tailrec def go(x: String, y: String): Unit = { - printf(fmt, l, x.take(w), y.take(w)) + val w = maxE + @tailrec def go(x: String, y: String, fmt2: Option[String]): Unit = { + fmt2 match { + case None => printf(fmt, l, x.take(w), y.take(w)) + case Some(f) => printf(f, x.take(w), y.take(w)) + } val hasMore = (x.length max y.length) > w - if (hasMore && !truncate) - go(x.drop(w), y.drop(w)) + if (hasMore && !truncate) { + def newFmt = fmt.replace(s"%${maxL}d:", " " * (maxL + 1)) + go(x.drop(w), y.drop(w), fmt2.orElse(Some(newFmt))) + } } - go(a, e) + go(e, a, None) } } else { println(LineDiff(expect, actual).expectActualColoured) From 6d663644be33c4f4856b6895b67dad0e0c6da9d9 Mon Sep 17 00:00:00 2001 From: David Barri Date: Wed, 22 Jun 2022 12:28:33 +1000 Subject: [PATCH 59/72] `useMemo*` done --- library/TODO.md | 4 - .../scalajs/react/hooks/HookMacros.scala | 25 ++- .../scalajs/react/hooks/HookMacros.scala | 26 ++- .../react/hooks/AbstractHookMacros.scala | 55 +++-- .../scalajs/react/test/emissions/Main.scala | 1 + .../react/test/emissions/UseMemo.scala | 16 ++ .../src/test/resources/rr-sjr/UseMemo-out2.js | 202 ++++++++++++++++++ .../src/test/resources/rr-sjr/UseMemo-out3.js | 187 ++++++++++++++++ .../test/emissions/ReactRefreshTest.scala | 1 + .../react/test/emissions/util/TestJs.scala | 8 + 10 files changed, 487 insertions(+), 38 deletions(-) create mode 100644 library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseMemo.scala create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/UseMemo-out2.js create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/UseMemo-out3.js diff --git a/library/TODO.md b/library/TODO.md index 548180215..d41199be7 100644 --- a/library/TODO.md +++ b/library/TODO.md @@ -32,10 +32,6 @@ def useLayoutEffectWithDeps [D, A](deps: => D)(effect: D => A)(impli def useLayoutEffectWithDepsBy [D, A](deps: Ctx => D)(effect: Ctx => D => A)(implicit a: UseEffectArg[A], r: Reusability[D], step: Step): step.Self def useLayoutEffectWithDepsBy [D, A](deps: CtxFn[D])(effect: CtxFn[D => A])(implicit a: UseEffectArg[A], r: Reusability[D], step: Step): step.Self -def useMemo [D, A](deps: => D)(create: D => A)(implicit r: Reusability[D], step: Step): step.Next[Reusable[A]] -def useMemoBy [D, A](deps: Ctx => D)(create: Ctx => D => A)(implicit r: Reusability[D], step: Step): step.Next[Reusable[A]] -def useMemoBy [D, A](deps: CtxFn[D])(create: CtxFn[D => A])(implicit r: Reusability[D], step: Step): step.Next[Reusable[A]] - def useReducer [S, A](reducer: (S, A) => S, initialState: => S)(implicit step: Step): step.Next[UseReducer[S, A]] def useReducerBy [S, A](reducer: Ctx => (S, A) => S, initialState: Ctx => S)(implicit step: Step): step.Next[UseReducer[S, A]] def useReducerBy [S, A](reducer: CtxFn[(S, A) => S], initialState: CtxFn[S])(implicit step: Step): step.Next[UseReducer[S, A]] diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala index af4ac1b99..b11b53816 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -56,6 +56,7 @@ class HookMacros(val c: Context) extends MacroUtils { private def JsFn : Tree = q"_root_.japgolly.scalajs.react.component.JsFn" private def PropsChildren: Tree = q"_root_.japgolly.scalajs.react.PropsChildren" private def React : Tree = q"_root_.japgolly.scalajs.react.facade.React" + private def Reusable : Tree = q"_root_.japgolly.scalajs.react.Reusable" private def ScalaFn : Tree = q"_root_.japgolly.scalajs.react.component.ScalaFn" private def SJS : Tree = q"_root_.scala.scalajs.js" @@ -199,6 +200,9 @@ class HookMacros(val c: Context) extends MacroUtils { override protected def reusableDepStateValue[D] = (rds, _) => q"$rds.value" + override protected def reusableValueByInt[A] = (i, a, _) => + q"$Reusable.implicitly($i).withValue($a)" + override protected def scalaFn0[A] = (_, body) => q"() => $body" @@ -214,6 +218,9 @@ class HookMacros(val c: Context) extends MacroUtils { override protected def useCallbackArgTypeJs[A, J <: js.Function] = _ => null // Not used in Scala 2 (i.e. in useCallbackArg{From,To}Js) + override protected def useMemo[A] = (a, d, _) => + q"$React.useMemo(() => $a, $d)" + override protected def useStateFn[S] = (tpe, body) => q"$React.useStateFn(() => $Box[$tpe]($body))" @@ -262,14 +269,15 @@ class HookMacros(val c: Context) extends MacroUtils { giveUp } - val rewriteAttempt = - for { - hookDefn <- hookMacros.parse(c.macroApplication) - rewriter <- hookMacros.rewriteComponent(hookDefn) - } yield rewriter - val result: Tree = - try + try { + + val rewriteAttempt = + for { + hookDefn <- hookMacros.parse(c.macroApplication) + rewriter <- hookMacros.rewriteComponent(hookDefn) + } yield rewriter + rewriteAttempt match { case Right(rewriter) => @@ -287,7 +295,8 @@ class HookMacros(val c: Context) extends MacroUtils { case Left(err) => onFailure(err()) } - catch { + + } catch { case err: Throwable => err.printStackTrace() onFailure(err.getMessage()) diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala index 76a081986..281e5473c 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala @@ -1,7 +1,7 @@ package japgolly.scalajs.react.hooks import japgolly.microlibs.compiletime.MacroEnv.* -import japgolly.scalajs.react.{Children, CtorType, PropsChildren, Reusability} +import japgolly.scalajs.react.{Children, CtorType, PropsChildren, Reusable, Reusability} import japgolly.scalajs.react.component.{JsFn, ScalaFn} import japgolly.scalajs.react.component.ScalaFn.Component import japgolly.scalajs.react.facade @@ -308,6 +308,9 @@ object HookMacros { override protected def reusableDepStateValue[D] = implicit (rds, tpeD) => '{ $rds.value } + override protected def reusableValueByInt[A] = implicit (i, a, tpeA) => + '{ Reusable.implicitly($i).withValue($a) } + override protected def scalaFn0[A] = implicit (tpe, body) => '{ () => $body } @@ -323,6 +326,9 @@ object HookMacros { override protected def useCallbackArgTypeJs[A, J <: js.Function] = x => TypeSelect(x.asTerm, "J").asTypeOf[J] + override protected def useMemo[A] = implicit (a, d, tpeA) => + '{ React.useMemo(() => $a, $d) } + override protected def useStateFn[S] = implicit (tpe, body) => '{ React.useStateFn(() => Box[$tpe]($body)) } @@ -430,14 +436,15 @@ object HookMacros { giveUp() } - val rewriteAttempt = - for { - hookDefn <- hookMacros.parse(macroApplication) - rewriter <- hookMacros.rewriteComponent(hookDefn + renderStep) - } yield rewriter - val result: Expr[Component[P, CT]] = - try + try { + + val rewriteAttempt = + for { + hookDefn <- hookMacros.parse(macroApplication) + rewriter <- hookMacros.rewriteComponent(hookDefn + renderStep) + } yield rewriter + rewriteAttempt match { case Right(rewriter) => @@ -461,7 +468,8 @@ object HookMacros { case Left(err) => onFailure(err()) } - catch { + + } catch { case err: Throwable => // err.printStackTrace() onFailure(err.getMessage()) diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala index 9215e5d78..051983c44 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala @@ -348,6 +348,7 @@ trait AbstractHookMacros { import AutoTypeImplicits._ trait X + trait Y def createUseCallbackHook[C](b: Rewriter, ucArg: Term, callback: Expr[C], hookDeps: Expr[HookDeps], tpeC: Type[C]): Ref = { val a = refToTerm(b.valDef(ucArg, "_arg")) // stablise for dependent types @@ -359,14 +360,23 @@ trait AbstractHookMacros { b.createHook(hook) } - def reusableDeps[D](b: Rewriter, depsExpr: Expr[D], reuse: Expr[Reusability[D]], tpeD: Type[D]): Expr[ReusableDepState[D]] = { - type DS = ReusableDepState[D] - val tpeODS = optionType(reusableDepStateType(tpeD)) - val stateRaw = b.valDef(useStateValue[Option[DS]](tpeODS, none(tpeODS)), "_state_raw") - val state = b.valDef(useStateFromJsBoxed[Option[DS]](tpeODS, stateRaw), "_state") - val deps = b.valDef(depsExpr, "_deps") - val depsState = b.valDef(reusableDepsLogic[D](deps, state, reuse, tpeD), "_deps_state") - depsState + def reusableDeps[D](b: Rewriter, depsExpr: Expr[D], reuse: Expr[Reusability[D]], tpeD: Type[D]): (Expr[D], Expr[Int]) = { + type DS = ReusableDepState[D] + val tpeODS = optionType(reusableDepStateType(tpeD)) + val stateRaw = b.valDef(useStateValue[Option[DS]](tpeODS, none(tpeODS)), "_state_raw") + val state = b.valDef(useStateFromJsBoxed[Option[DS]](tpeODS, stateRaw), "_state") + val newDeps = b.valDef(depsExpr, "_deps") + val rds = b.valDef(reusableDepsLogic[D](newDeps, state, reuse, tpeD), "_deps_state") + val deps = reusableDepStateValue(rds, tpeD) + val rev = reusableDepStateRev(rds) + (deps, rev) + } + + def reusableByDeps[D, A](b: Rewriter, depsExpr: Expr[D], reuse: Expr[Reusability[D]], tpeD: Type[D], tpeA: Type[A]) + (create: (Expr[D], Expr[Int]) => Expr[A]): Expr[Reusable[A]] = { + val (deps, rev) = reusableDeps[D](b, depsExpr, reuse, tpeD) + val value = b.valDef(create(deps, rev), "_val") + reusableValueByInt[A](rev, value, tpeA) } implicit def autoSomeRefs(r: Ref): Option[Ref] = @@ -434,18 +444,25 @@ trait AbstractHookMacros { case "useCallbackWithDeps" | "useCallbackWithDepsBy" => val (List(tpeD, tpeC), List(List(depsFn), List(callbackFnFn), List(ucArg, reuse, _))) = step.sig : @nowarn maybeBy(callbackFnFn) { (b, withCtx) => - val rds = reusableDeps[X](b, withCtx(depsFn), reuse, tpeD) - val deps = reusableDepStateValue(rds, tpeD) - val callbackFn = withCtx(callbackFnFn) - val callback = call(callbackFn, deps :: Nil, false) - val hookDeps = hookDepsIntArray1(reusableDepStateRev(rds)) + val (deps, rev) = reusableDeps[X](b, withCtx(depsFn), reuse, tpeD) + val callbackFn = withCtx(callbackFnFn) + val callback = call(callbackFn, deps :: Nil, false) + val hookDeps = hookDepsIntArray1(rev) createUseCallbackHook[X](b, ucArg, callback, hookDeps, tpeC) } - // case "useMemo" | "useMemoBy" => - // val (List(d, a), List(List(deps), List(create), List(reuse, step))) = step.sig : @nowarn - // maybeBy(deps) { (b, withCtx) => - // } + case "useMemo" | "useMemoBy" => + val (List(tpeD, tpeA), List(List(depsFn), List(createFnFn), List(reuse, _))) = step.sig : @nowarn + maybeBy(depsFn) { (b, withCtx) => + b.createHook { + reusableByDeps[X, Y](b, withCtx(depsFn), reuse, tpeD, tpeA) { (deps, rev) => + val createFn = withCtx(createFnFn) + val newValue = call(createFn, asTerm(deps) :: Nil, false) + val hookDeps = hookDepsIntArray1(rev) + useMemo[Y](newValue, hookDeps, tpeA) + } + } + } case "useState" | "useStateBy" => val (List(tpe), List(List(initialState), List(_))) = step.sig : @nowarn @@ -488,6 +505,8 @@ trait AbstractHookMacros { protected def reusableDepStateValue[D]: (Expr[ReusableDepState[D]], Type[D]) => Expr[D] + protected def reusableValueByInt[A]: (Expr[Int], Expr[A], Type[A]) => Expr[Reusable[A]] + protected def scalaFn0[A]: (Type[A], Expr[A]) => Expr[() => A] protected def useCallback[F <: js.Function]: (Expr[F], Expr[HookDeps], Type[F]) => Expr[F] @@ -498,6 +517,8 @@ trait AbstractHookMacros { protected def useCallbackArgTypeJs[A, J <: js.Function]: (Expr[Hooks.UseCallbackArg.To[A, J]]) => Type[J] + protected def useMemo[A]: (Expr[A], Expr[HookDeps], Type[A]) => Expr[A] + protected def useStateFn[S]: (Type[S], Expr[S]) => Expr[React.UseState[Box[S]]] protected def useStateValue[S]: (Type[S], Expr[S]) => Expr[React.UseState[Box[S]]] diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala index 04d97c370..0d7636e0e 100644 --- a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala @@ -24,6 +24,7 @@ object Main { JustPropsChildrenViaHookApi.Component(0)(<.div), JustPropsViaHookApi .Component(0), UseCallback .Component(0), + UseMemo .Component(0), UseState .Component(0), UseStateWithReuse .Component(0), ) diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseMemo.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseMemo.scala new file mode 100644 index 000000000..df1c0fb12 --- /dev/null +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseMemo.scala @@ -0,0 +1,16 @@ +package japgolly.scalajs.react.test.emissions + +import japgolly.scalajs.react._ +import japgolly.scalajs.react.vdom.html_<^._ + +object UseMemo { + + val Component = ScalaFnComponent.withHooks[Int] + .useMemo("blah")(_.length) + .useMemoBy((p, a) => (p + a).toString)((p, a) => _.length + p + a) + .useMemoBy($ => ($.props + $.hook1 + $.hook2).toString)($ => _.length + $.props + $.hook1 + $.hook2) + .renderRR { (p, a, b, c) => + val sum = p + a + b + c + sum + } +} diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseMemo-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseMemo-out2.js new file mode 100644 index 000000000..97abeb8ea --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseMemo-out2.js @@ -0,0 +1,202 @@ +'use strict'; + +var _s = $RefreshSig$(); + +import * as $i_react from "react"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusability from "./japgolly.scalajs.react.Reusability.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusable from "./japgolly.scalajs.react.Reusable.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusable$0024 from "./japgolly.scalajs.react.Reusable$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024 from "./japgolly.scalajs.react.hooks.CustomHook$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2 from "./japgolly.scalajs.react.hooks.HookCtx$P2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 from "./japgolly.scalajs.react.internal.Singleton$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002eFunction1 from "./scala.Function1.js"; + +function $c_Ljapgolly_scalajs_react_test_emissions_UseMemo$() { + this.Ljapgolly_scalajs_react_test_emissions_UseMemo$__f_Component = null; + $n_Ljapgolly_scalajs_react_test_emissions_UseMemo$ = this; + + var rawComponent = arg1$2 => $m_Ljapgolly_scalajs_react_test_emissions_UseMemo$().japgolly$scalajs$react$test$emissions$UseMemo$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2); + + var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$(), null)); + this.Ljapgolly_scalajs_react_test_emissions_UseMemo$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$1.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_UseMemo$ }; +$c_Ljapgolly_scalajs_react_test_emissions_UseMemo$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_UseMemo$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_UseMemo$; + +function $h_Ljapgolly_scalajs_react_test_emissions_UseMemo$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_UseMemo$ }; +$h_Ljapgolly_scalajs_react_test_emissions_UseMemo$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_UseMemo$.prototype; + +$c_Ljapgolly_scalajs_react_test_emissions_UseMemo$.prototype.japgolly$scalajs$react$test$emissions$UseMemo$$$anonfun$Component$2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__I = function (hook1_deps_state$1) { + var arg1 = hook1_deps_state$1.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; + var x$1 = arg1; + return x$1.length | 0; +}; + +$c_Ljapgolly_scalajs_react_test_emissions_UseMemo$.prototype.japgolly$scalajs$react$test$emissions$UseMemo$$$anonfun$Component$4__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_Reusable__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__I = function (props$1, hook1$1, hook2_deps_state$1) { + var arg1 = hook2_deps_state$1.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; + var x$2 = arg1; + return ((x$2.length | 0) + (props$1.a | 0) | 0) + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), hook1$1.value__O()) | 0) | 0; +}; + +$c_Ljapgolly_scalajs_react_test_emissions_UseMemo$.prototype.japgolly$scalajs$react$test$emissions$UseMemo$$$anonfun$Component$6__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__I = function (hook3_ctx$1, hook3_deps_state$1) { + var arg1 = hook3_deps_state$1.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; + var x$3 = arg1; + var $$x3 = x$3.length; + var $$x2 = hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); + var r = hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; + var $$x1 = r.value__O(); + $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); + var r$1 = hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; + return ((($$x3 | 0) + ($$x2 | 0) | 0) + ($$x1 | 0) | 0) + (r$1.value__O() | 0) | 0; +}; + +$c_Ljapgolly_scalajs_react_test_emissions_UseMemo$.prototype.japgolly$scalajs$react$test$emissions$UseMemo$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s(function (props) { + _s(); + + var hook1_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_java$002elang$002eCharacter$0024.$m_s_None$())); + var hook1_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_state_raw); + var $$x1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); + var this$1 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var hook1_deps_state = $$x1.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState("blah", hook1_state, this$1.by_$eq$eq__F2()); + var $$x3 = $i_react; + var a = [hook1_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev]; + var $$x2 = $$x3.useMemo((hook1_deps_state$1 => () => $m_Ljapgolly_scalajs_react_test_emissions_UseMemo$().japgolly$scalajs$react$test$emissions$UseMemo$$$anonfun$Component$2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__I(hook1_deps_state$1))(hook1_deps_state), a); + var hook1_val = $$x2 | 0; + var this$9 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); + var a$1 = hook1_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev; + var evidence$2 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var this$8 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var evidence$3 = this$8.by_$eq$eq__F2(); + var e = new $j_japgolly$002escalajs$002ereact$002eReusability.$c_Ljapgolly_scalajs_react_Reusability(evidence$3); + var r = e.Ljapgolly_scalajs_react_Reusability__f_test; + var hook1 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$p_Ljapgolly_scalajs_react_Reusable$__root__O__F1__Ljapgolly_scalajs_react_Reusable(this$9, a$1, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((evidence$1, reuse, a$2) => x$6$2 => { + var x$6 = x$6$2; + var x1 = x$6.Ljapgolly_scalajs_react_Reusable__f_japgolly$scalajs$react$Reusable$$root; + + if (x1 !== null) { + var o9 = evidence$1.unapply__O__s_Option(x1); + + if (!o9.isEmpty__Z() && o9.get__O() !== null) { + return !!reuse.apply__O__O__O(a$2, x1); + } + } + + ; + return false; + })(evidence$2, r, a$1))).withValue__O__Ljapgolly_scalajs_react_Reusable(hook1_val); + var hook2_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_java$002elang$002eCharacter$0024.$m_s_None$())); + var hook2_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_state_raw); + var this$13 = (props.a | 0) + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), hook1.value__O()) | 0) | 0; + var hook2_deps = "" + this$13; + var $$x4 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); + var this$15 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var hook2_deps_state = $$x4.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(hook2_deps, hook2_state, this$15.by_$eq$eq__F2()); + var $$x6 = $i_react; + var a$3 = [hook2_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev]; + var $$x5 = $$x6.useMemo(((props$1, hook1$1, hook2_deps_state$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_UseMemo$().japgolly$scalajs$react$test$emissions$UseMemo$$$anonfun$Component$4__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_Reusable__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__I(props$1, hook1$1, hook2_deps_state$1))(props, hook1, hook2_deps_state), a$3); + var hook2_val = $$x5 | 0; + var this$23 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); + var a$4 = hook2_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev; + var evidence$2$1 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var this$22 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var evidence$3$1 = this$22.by_$eq$eq__F2(); + var e$1 = new $j_japgolly$002escalajs$002ereact$002eReusability.$c_Ljapgolly_scalajs_react_Reusability(evidence$3$1); + var r$1 = e$1.Ljapgolly_scalajs_react_Reusability__f_test; + var hook2 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$p_Ljapgolly_scalajs_react_Reusable$__root__O__F1__Ljapgolly_scalajs_react_Reusable(this$23, a$4, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((evidence$1$1, reuse$1, a$5) => x$6$2$1 => { + var x$6$1 = x$6$2$1; + var x1$1 = x$6$1.Ljapgolly_scalajs_react_Reusable__f_japgolly$scalajs$react$Reusable$$root; + + if (x1$1 !== null) { + var o9$1 = evidence$1$1.unapply__O__s_Option(x1$1); + + if (!o9$1.isEmpty__Z() && o9$1.get__O() !== null) { + return !!reuse$1.apply__O__O__O(a$5, x1$1); + } + } + + ; + return false; + })(evidence$2$1, r$1, a$4))).withValue__O__Ljapgolly_scalajs_react_Reusable(hook2_val); + var props$2 = props.a; + var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$2, hook1, hook2); + var hook3_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_java$002elang$002eCharacter$0024.$m_s_None$())); + var hook3_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_state_raw); + var $$x8 = hook3_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); + var r$2 = hook3_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; + var $$x7 = r$2.value__O(); + $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); + var r$3 = hook3_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; + var this$29 = (($$x8 | 0) + ($$x7 | 0) | 0) + (r$3.value__O() | 0) | 0; + var hook3_deps = "" + this$29; + var $$x9 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); + var this$31 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var hook3_deps_state = $$x9.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(hook3_deps, hook3_state, this$31.by_$eq$eq__F2()); + var $$x11 = $i_react; + var a$6 = [hook3_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev]; + var $$x10 = $$x11.useMemo(((hook3_ctx$1, hook3_deps_state$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_UseMemo$().japgolly$scalajs$react$test$emissions$UseMemo$$$anonfun$Component$6__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__I(hook3_ctx$1, hook3_deps_state$1))(hook3_ctx, hook3_deps_state), a$6); + var hook3_val = $$x10 | 0; + var this$39 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); + var a$7 = hook3_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev; + var evidence$2$2 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var this$38 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var evidence$3$2 = this$38.by_$eq$eq__F2(); + var e$2 = new $j_japgolly$002escalajs$002ereact$002eReusability.$c_Ljapgolly_scalajs_react_Reusability(evidence$3$2); + var r$4 = e$2.Ljapgolly_scalajs_react_Reusability__f_test; + var hook3 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$p_Ljapgolly_scalajs_react_Reusable$__root__O__F1__Ljapgolly_scalajs_react_Reusable(this$39, a$7, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((evidence$1$2, reuse$2, a$8) => x$6$2$2 => { + var x$6$3 = x$6$2$2; + var x1$2 = x$6$3.Ljapgolly_scalajs_react_Reusable__f_japgolly$scalajs$react$Reusable$$root; + + if (x1$2 !== null) { + var o9$2 = evidence$1$2.unapply__O__s_Option(x1$2); + + if (!o9$2.isEmpty__Z() && o9$2.get__O() !== null) { + return !!reuse$2.apply__O__O__O(a$8, x1$2); + } + } + + ; + return false; + })(evidence$2$2, r$4, a$7))).withValue__O__Ljapgolly_scalajs_react_Reusable(hook3_val); + var sum = (((props.a | 0) + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), hook1.value__O()) | 0) | 0) + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), hook2.value__O()) | 0) | 0) + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), hook3.value__O()) | 0) | 0; + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + return new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; +}, "t8QZfg+hTPFXW2BFIxozHWoiMJ0="); +var $d_Ljapgolly_scalajs_react_test_emissions_UseMemo$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_UseMemo$: 0 +}, false, "japgolly.scalajs.react.test.emissions.UseMemo$", { + Ljapgolly_scalajs_react_test_emissions_UseMemo$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_UseMemo$ }; +$c_Ljapgolly_scalajs_react_test_emissions_UseMemo$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_UseMemo$; +var $n_Ljapgolly_scalajs_react_test_emissions_UseMemo$; + +function $m_Ljapgolly_scalajs_react_test_emissions_UseMemo$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_UseMemo$) { + $n_Ljapgolly_scalajs_react_test_emissions_UseMemo$ = new $c_Ljapgolly_scalajs_react_test_emissions_UseMemo$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_UseMemo$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_UseMemo$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseMemo-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseMemo-out3.js new file mode 100644 index 000000000..9965662e3 --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseMemo-out3.js @@ -0,0 +1,187 @@ +'use strict'; + +import * as $i_react from "react"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusability from "./japgolly.scalajs.react.Reusability.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusable from "./japgolly.scalajs.react.Reusable.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusable$0024 from "./japgolly.scalajs.react.Reusable$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024 from "./japgolly.scalajs.react.hooks.CustomHook$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2 from "./japgolly.scalajs.react.hooks.HookCtx$P2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002eFunction1 from "./scala.Function1.js"; + +function $c_Ljapgolly_scalajs_react_test_emissions_UseMemo$() { + var _s = $RefreshSig$(); + + this.Ljapgolly_scalajs_react_test_emissions_UseMemo$__f_Component = null; + $n_Ljapgolly_scalajs_react_test_emissions_UseMemo$ = this; + + var rawComponent = props => { + _s(); + + var hook1_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_java$002elang$002eCharacter$0024.$m_s_None$())); + var hook1_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_state_raw); + var $$x1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); + var this$2 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var hook1_deps_state = $$x1.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState("blah", hook1_state, this$2.by_$eq$eq__F2()); + var hook1_val = $i_react.useMemo((hook1_deps_state$2 => () => { + var _$1$proxy1 = hook1_deps_state$2.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; + return _$1$proxy1.length | 0; + })(hook1_deps_state), [hook1_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev]) | 0; + var this$8 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); + var a = hook1_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev; + var evidence$2 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var this$7 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var evidence$3 = this$7.by_$eq$eq__F2(); + var e = new $j_japgolly$002escalajs$002ereact$002eReusability.$c_Ljapgolly_scalajs_react_Reusability(evidence$3); + var r = e.Ljapgolly_scalajs_react_Reusability__f_test; + var hook1 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$p_Ljapgolly_scalajs_react_Reusable$__root__O__F1__Ljapgolly_scalajs_react_Reusable(this$8, a, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((a$2, reuse$2, evidence$1$2) => _$6 => { + var _$6$1 = _$6; + var x1 = _$6$1.Ljapgolly_scalajs_react_Reusable__f_root; + + if (x1 !== null) { + var x2 = evidence$1$2.unapply__O__s_Option(x1); + + if (!x2.isEmpty__Z()) { + var x3 = x2.get__O(); + return !!reuse$2.apply__O__O__O(a$2, x3); + } + } + + ; + return false; + })(a, r, evidence$2))).withValue__O__Ljapgolly_scalajs_react_Reusable(hook1_val); + var hook2_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_java$002elang$002eCharacter$0024.$m_s_None$())); + var hook2_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_state_raw); + var p = props.a | 0; + var this$12 = p + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), hook1.value__O()) | 0) | 0; + var hook2_deps = "" + this$12; + var $$x2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); + var this$14 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var hook2_deps_state = $$x2.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(hook2_deps, hook2_state, this$14.by_$eq$eq__F2()); + var hook2_val = $i_react.useMemo(((props$2, hook1$2, hook2_deps_state$2) => () => { + var p$1 = props$2.a | 0; + var _$2 = hook2_deps_state$2.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; + return ((_$2.length | 0) + p$1 | 0) + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), hook1$2.value__O()) | 0) | 0; + })(props, hook1, hook2_deps_state), [hook2_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev]) | 0; + var this$20 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); + var a$1 = hook2_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev; + var evidence$2$1 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var this$19 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var evidence$3$1 = this$19.by_$eq$eq__F2(); + var e$1 = new $j_japgolly$002escalajs$002ereact$002eReusability.$c_Ljapgolly_scalajs_react_Reusability(evidence$3$1); + var r$1 = e$1.Ljapgolly_scalajs_react_Reusability__f_test; + var hook2 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$p_Ljapgolly_scalajs_react_Reusable$__root__O__F1__Ljapgolly_scalajs_react_Reusable(this$20, a$1, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((a$2$1, reuse$2$1, evidence$1$2$1) => _$6$2 => { + var _$6$3 = _$6$2; + var x1$1 = _$6$3.Ljapgolly_scalajs_react_Reusable__f_root; + + if (x1$1 !== null) { + var x2$1 = evidence$1$2$1.unapply__O__s_Option(x1$1); + + if (!x2$1.isEmpty__Z()) { + var x3$1 = x2$1.get__O(); + return !!reuse$2$1.apply__O__O__O(a$2$1, x3$1); + } + } + + ; + return false; + })(a$1, r$1, evidence$2$1))).withValue__O__Ljapgolly_scalajs_react_Reusable(hook2_val); + var props$1 = props.a; + var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$1, hook1, hook2); + var hook3_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_java$002elang$002eCharacter$0024.$m_s_None$())); + var hook3_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_state_raw); + var $$x4 = hook3_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); + var r$2 = hook3_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; + var $$x3 = r$2.value__O(); + $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); + var r$3 = hook3_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; + var this$26 = (($$x4 | 0) + ($$x3 | 0) | 0) + (r$3.value__O() | 0) | 0; + var hook3_deps = "" + this$26; + var $$x5 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); + var this$28 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var hook3_deps_state = $$x5.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(hook3_deps, hook3_state, this$28.by_$eq$eq__F2()); + var hook3_val = $i_react.useMemo(((hook3_ctx$2, hook3_deps_state$2) => () => { + var _$3$proxy1 = hook3_deps_state$2.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; + var $$x8 = _$3$proxy1.length; + var $$x7 = hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); + var r$4 = hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; + var $$x6 = r$4.value__O(); + $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); + var r$5 = hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; + return ((($$x8 | 0) + ($$x7 | 0) | 0) + ($$x6 | 0) | 0) + (r$5.value__O() | 0) | 0; + })(hook3_ctx, hook3_deps_state), [hook3_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev]) | 0; + var this$35 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); + var a$3 = hook3_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev; + var evidence$2$2 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var this$34 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var evidence$3$2 = this$34.by_$eq$eq__F2(); + var e$2 = new $j_japgolly$002escalajs$002ereact$002eReusability.$c_Ljapgolly_scalajs_react_Reusability(evidence$3$2); + var r$6 = e$2.Ljapgolly_scalajs_react_Reusability__f_test; + var hook3 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$p_Ljapgolly_scalajs_react_Reusable$__root__O__F1__Ljapgolly_scalajs_react_Reusable(this$35, a$3, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((a$2$2, reuse$2$2, evidence$1$2$2) => _$6$4 => { + var _$6$5 = _$6$4; + var x1$2 = _$6$5.Ljapgolly_scalajs_react_Reusable__f_root; + + if (x1$2 !== null) { + var x2$2 = evidence$1$2$2.unapply__O__s_Option(x1$2); + + if (!x2$2.isEmpty__Z()) { + var x3$2 = x2$2.get__O(); + return !!reuse$2$2.apply__O__O__O(a$2$2, x3$2); + } + } + + ; + return false; + })(a$3, r$6, evidence$2$2))).withValue__O__Ljapgolly_scalajs_react_Reusable(hook3_val); + var p$2 = props.a | 0; + var sum = ((p$2 + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), hook1.value__O()) | 0) | 0) + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), hook2.value__O()) | 0) | 0) + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), hook3.value__O()) | 0) | 0; + return ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; + }; + + _s(rawComponent, "YQS7/w7UkmImlk8JQNlKaOp61ro="); + + var $$x9 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$43 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); + this.Ljapgolly_scalajs_react_test_emissions_UseMemo$__f_Component = $$x9.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$43.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_UseMemo$ }; +$c_Ljapgolly_scalajs_react_test_emissions_UseMemo$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_UseMemo$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_UseMemo$; + +function $h_Ljapgolly_scalajs_react_test_emissions_UseMemo$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_UseMemo$ }; +$h_Ljapgolly_scalajs_react_test_emissions_UseMemo$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_UseMemo$.prototype; +var $d_Ljapgolly_scalajs_react_test_emissions_UseMemo$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_UseMemo$: 0 +}, false, "japgolly.scalajs.react.test.emissions.UseMemo$", { + Ljapgolly_scalajs_react_test_emissions_UseMemo$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_UseMemo$ }; +$c_Ljapgolly_scalajs_react_test_emissions_UseMemo$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_UseMemo$; +var $n_Ljapgolly_scalajs_react_test_emissions_UseMemo$; + +function $m_Ljapgolly_scalajs_react_test_emissions_UseMemo$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_UseMemo$) { + $n_Ljapgolly_scalajs_react_test_emissions_UseMemo$ = new $c_Ljapgolly_scalajs_react_test_emissions_UseMemo$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_UseMemo$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_UseMemo$ }; diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala index 91cef9f18..5d2a3f432 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala @@ -34,6 +34,7 @@ object ReactRefreshTest extends TestSuite { "JustPropsChildrenViaHookApi" - testScala(assertRR = false) // TODO: "JustPropsViaHookApi" - testScala(assertRR = false) // TODO: "UseCallback" - testScala() + "UseMemo" - testScala() "UseState" - testScala() "UseStateWithReuse" - testScala() } diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala index a6cfec0ef..0f0791640 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala @@ -81,6 +81,14 @@ object TestJs { .replace("PropsChildren$", "PropsChildren") + .replace( + "$j_java_lang_Character$.$m_s_reflect_ManifestFactory$IntManifest$()", + "$j_scala_reflect_ManifestFactory$IntManifest$.$m_s_reflect_ManifestFactory$IntManifest$()") + + .replace( + "$j_sjr_hooks_Api$Primary.$m_Lsjr_hooks_CustomHook$()", + "$j_sjr_hooks_CustomHook$.$m_Lsjr_hooks_CustomHook$()") + // Scala 3 only for some reason .replace("$FirstStep.$", "$First.$") From 142f6e132f68dfea82765d3e36c57f3d2ae26923 Mon Sep 17 00:00:00 2001 From: David Barri Date: Wed, 22 Jun 2022 15:28:01 +1000 Subject: [PATCH 60/72] `use{Context,DebugValue,Reducer}` done --- .../downstream/mima200/HookUseReducer.scala | 29 +++ library/TODO.md | 12 -- .../scalajs/react/hooks/HookMacros.scala | 12 ++ .../scalajs/react/hooks/HookMacros.scala | 12 ++ .../react/hooks/AbstractHookMacros.scala | 42 ++++- .../japgolly/scalajs/react/hooks/Hooks.scala | 4 +- .../react/test/emissions/HooksTrivial.scala | 30 ++++ .../scalajs/react/test/emissions/Main.scala | 1 + .../resources/rr-sjr/HooksTrivial-out2.js | 165 ++++++++++++++++++ .../resources/rr-sjr/HooksTrivial-out3.js | 156 +++++++++++++++++ .../test/emissions/ReactRefreshTest.scala | 1 + 11 files changed, 444 insertions(+), 20 deletions(-) create mode 100644 downstream-tests/mima-2.0.0/src/main/scala/downstream/mima200/HookUseReducer.scala create mode 100644 library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksTrivial.scala create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out2.js create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out3.js diff --git a/downstream-tests/mima-2.0.0/src/main/scala/downstream/mima200/HookUseReducer.scala b/downstream-tests/mima-2.0.0/src/main/scala/downstream/mima200/HookUseReducer.scala new file mode 100644 index 000000000..0bddb7324 --- /dev/null +++ b/downstream-tests/mima-2.0.0/src/main/scala/downstream/mima200/HookUseReducer.scala @@ -0,0 +1,29 @@ +package downstream.mima200 + +import japgolly.scalajs.react._ +import japgolly.scalajs.react.vdom.html_<^._ + +// Because in `object Hooks.UseReducer`, I changed `private def _unsafeCreate` to `def fromJs` +object HookUseReducer { + + final case class PI(pi: Int) { + def unary_- : PI = PI(-pi) + def *(n: Int): PI = PI(pi * n) + def +(n: Int): PI = PI(pi + n) + def +(n: PI): PI = PI(pi + n.pi) + } + + private def add(n: Int): (Int, Int) => Int = _ + _ + n + + val comp = ScalaFnComponent.withHooks[PI] + .useReducer(add(0), 100) + .useReducerBy((_, s1) => add(s1.value), (p, s1) => p.pi + s1.value) + .useReducerBy($ => add($.hook1.value), $ => $.props.pi + $.hook1.value + $.hook2.value) + .render((p, s1, s2, s3) => + <.div( + <.div(s"P=$p, s1=${s1.value}, s2=${s2.value}, s3=${s3.value}"), + <.button(^.onClick --> s1.dispatch(1)), + <.button(^.onClick --> s2.dispatch(10)), + <.button(^.onClick --> s3.dispatch(100)), + )) +} diff --git a/library/TODO.md b/library/TODO.md index d41199be7..9068c8c47 100644 --- a/library/TODO.md +++ b/library/TODO.md @@ -1,14 +1,6 @@ ```scala // Api.scala -def useContext [A](ctx: Context[A])(implicit step: Step): step.Next[A] -def useContextBy [A](f: Ctx => Context[A])(implicit step: Step): step.Next[A] -def useContextBy [A](f: CtxFn[Context[A]])(implicit step: Step): step.Next[A] - -def useDebugValue (desc: => Any)(implicit step: Step): step.Self -def useDebugValueBy (desc: Ctx => Any)(implicit step: Step): step.Self -def useDebugValueBy (f: CtxFn[Any])(implicit step: Step): step.Self - def useEffect [A](effect: A)(implicit a: UseEffectArg[A], step: Step): step.Self def useEffectBy [A](init: Ctx => A)(implicit a: UseEffectArg[A], step: Step): step.Self def useEffectBy [A](init: CtxFn[A])(implicit a: UseEffectArg[A], step: Step): step.Self @@ -32,10 +24,6 @@ def useLayoutEffectWithDeps [D, A](deps: => D)(effect: D => A)(impli def useLayoutEffectWithDepsBy [D, A](deps: Ctx => D)(effect: Ctx => D => A)(implicit a: UseEffectArg[A], r: Reusability[D], step: Step): step.Self def useLayoutEffectWithDepsBy [D, A](deps: CtxFn[D])(effect: CtxFn[D => A])(implicit a: UseEffectArg[A], r: Reusability[D], step: Step): step.Self -def useReducer [S, A](reducer: (S, A) => S, initialState: => S)(implicit step: Step): step.Next[UseReducer[S, A]] -def useReducerBy [S, A](reducer: Ctx => (S, A) => S, initialState: Ctx => S)(implicit step: Step): step.Next[UseReducer[S, A]] -def useReducerBy [S, A](reducer: CtxFn[(S, A) => S], initialState: CtxFn[S])(implicit step: Step): step.Next[UseReducer[S, A]] - def useRef [A](initialValue: => A)(implicit step: Step): step.Next[UseRef[A]] def useRefBy [A](f: CtxFn[A])(implicit step: Step): step.Next[UseRef[A]] def useRefBy [A](initialValue: Ctx => A)(implicit step: Step): step.Next[UseRef[A]] diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala index b11b53816..77cab4873 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -218,9 +218,21 @@ class HookMacros(val c: Context) extends MacroUtils { override protected def useCallbackArgTypeJs[A, J <: js.Function] = _ => null // Not used in Scala 2 (i.e. in useCallbackArg{From,To}Js) + override protected def useContext[A] = (ctx, _) => + q"$React.useContext($ctx.raw)" + + override protected def useDebugValue = desc => + q"$React.useDebugValue[Null](null, _ => $desc)" + override protected def useMemo[A] = (a, d, _) => q"$React.useMemo(() => $a, $d)" + override protected def useReducer[S, A] = (r, s, tpeS, tpeA) => + q"$React.useReducer[Null, $tpeS, $tpeA]($r, null, _ => $s)" + + override protected def useReducerFromJs[S, A] = (raw, _, _) => + q"$Hooks.UseReducer.fromJs($raw)" + override protected def useStateFn[S] = (tpe, body) => q"$React.useStateFn(() => $Box[$tpe]($body))" diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala index 281e5473c..4152a10b8 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala @@ -326,9 +326,21 @@ object HookMacros { override protected def useCallbackArgTypeJs[A, J <: js.Function] = x => TypeSelect(x.asTerm, "J").asTypeOf[J] + override protected def useContext[A] = implicit (ctx, tpe) => + '{ React.useContext($ctx.raw) } + + override protected def useDebugValue = desc => + '{ React.useDebugValue[Null](null, _ => $desc) } + override protected def useMemo[A] = implicit (a, d, tpeA) => '{ React.useMemo(() => $a, $d) } + override protected def useReducer[S, A] = implicit (r, s, tpeS, tpeA) => + '{ React.useReducer[Null, $tpeS, $tpeA](js.Any.fromFunction2($r), null, _ => $s) } + + override protected def useReducerFromJs[S, A] = implicit (raw, tpeS, tpeA) => + '{ Hooks.UseReducer.fromJs($raw) } + override protected def useStateFn[S] = implicit (tpe, body) => '{ React.useStateFn(() => Box[$tpe]($body)) } diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala index 051983c44..48e4867af 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala @@ -1,5 +1,6 @@ package japgolly.scalajs.react.hooks +import japgolly.scalajs.react.React.Context import japgolly.scalajs.react.facade.React import japgolly.scalajs.react.facade.React.HookDeps import japgolly.scalajs.react.hooks.CustomHook.ReusableDepState @@ -451,6 +452,18 @@ trait AbstractHookMacros { createUseCallbackHook[X](b, ucArg, callback, hookDeps, tpeC) } + case "useContext" | "useContextBy" => + val (List(tpe), List(List(ctxFn), List(_))) = step.sig : @nowarn + maybeBy(ctxFn) { (b, withCtx) => + b.createHook(useContext[X](withCtx(ctxFn), tpe)) + } + + case "useDebugValue" | "useDebugValueBy" => + val (Nil, List(List(descFn), List(_))) = step.sig : @nowarn + maybeBy(descFn) { (b, withCtx) => + b.createHook(useDebugValue(withCtx(descFn)), discard = true) + } + case "useMemo" | "useMemoBy" => val (List(tpeD, tpeA), List(List(depsFn), List(createFnFn), List(reuse, _))) = step.sig : @nowarn maybeBy(depsFn) { (b, withCtx) => @@ -464,17 +477,26 @@ trait AbstractHookMacros { } } + case "useReducer" | "useReducerBy" => + val (List(tpeS, tpeA), List(List(reducerFn, initialStateFn), List(_))) = step.sig : @nowarn + maybeBy(reducerFn) { (b, withCtx) => + val reducer = withCtx(reducerFn) + val initialState = withCtx(initialStateFn) + val raw = b.createRaw(useReducer[X, Y](reducer, initialState, tpeS, tpeA)) + b.createHook(useReducerFromJs[X, Y](raw, tpeS, tpeA)) + } + case "useState" | "useStateBy" => - val (List(tpe), List(List(initialState), List(_))) = step.sig : @nowarn - maybeBy(initialState) { (b, withCtx) => - val raw = b.createRaw(useStateFn[X](tpe, withCtx(initialState))) + val (List(tpe), List(List(initialStateFn), List(_))) = step.sig : @nowarn + maybeBy(initialStateFn) { (b, withCtx) => + val raw = b.createRaw(useStateFn[X](tpe, withCtx(initialStateFn))) b.createHook(useStateFromJsBoxed[X](tpe, raw)) } case "useStateWithReuse" | "useStateWithReuseBy" => - val (List(tpe), List(List(initialState), List(ct, reuse, _))) = step.sig : @nowarn - maybeBy(initialState) { (b, withCtx) => - val raw = b.createRaw(useStateFn[X](tpe, withCtx(initialState))) + val (List(tpe), List(List(initialStateFn), List(ct, reuse, _))) = step.sig : @nowarn + maybeBy(initialStateFn) { (b, withCtx) => + val raw = b.createRaw(useStateFn[X](tpe, withCtx(initialStateFn))) b.createHook(useStateWithReuseFromJsBoxed[X](tpe, raw, reuse, ct)) } @@ -517,8 +539,16 @@ trait AbstractHookMacros { protected def useCallbackArgTypeJs[A, J <: js.Function]: (Expr[Hooks.UseCallbackArg.To[A, J]]) => Type[J] + protected def useContext[A]: (Expr[Context[A]], Type[A]) => Expr[A] + + protected def useDebugValue: Expr[Any] => Expr[Unit] + protected def useMemo[A]: (Expr[A], Expr[HookDeps], Type[A]) => Expr[A] + protected def useReducer[S, A]: (Expr[(S, A) => S], Expr[S], Type[S], Type[A]) => Expr[React.UseReducer[S, A]] + + protected def useReducerFromJs[S, A]: (Expr[React.UseReducer[S, A]], Type[S], Type[A]) => Expr[Hooks.UseReducer[S, A]] + protected def useStateFn[S]: (Type[S], Expr[S]) => Expr[React.UseState[Box[S]]] protected def useStateValue[S]: (Type[S], Expr[S]) => Expr[React.UseState[Box[S]]] diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Hooks.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Hooks.scala index 9ee7328bc..6cd6a2d0e 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Hooks.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Hooks.scala @@ -131,9 +131,9 @@ object Hooks { unsafeCreate[Null, S, A](reducer, null, _ => initialState) def unsafeCreate[I, S, A](reducer: (S, A) => S, initialArg: I, init: I => S): UseReducer[S, A] = - _unsafeCreate(facade.React.useReducer[I, S, A](reducer, initialArg, init)) + fromJs(facade.React.useReducer[I, S, A](reducer, initialArg, init)) - private def _unsafeCreate[S, A](originalResult: facade.React.UseReducer[S, A]): UseReducer[S, A] = { + def fromJs[S, A](originalResult: facade.React.UseReducer[S, A]): UseReducer[S, A] = { val originalDispatch = Reusable.byRef(originalResult._2) UseReducer(originalResult, originalDispatch) } diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksTrivial.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksTrivial.scala new file mode 100644 index 000000000..34017ee45 --- /dev/null +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksTrivial.scala @@ -0,0 +1,30 @@ +package japgolly.scalajs.react.test.emissions + +import japgolly.scalajs.react._ +import japgolly.scalajs.react.vdom.html_<^._ +import org.scalajs.dom.console + +object HooksTrivial { + + private val ctx = React.createContext(100) + private def add(n: Int): (Int, Int) => Int = _ + _ + n + + val Component = ScalaFnComponent.withHooks[Int] + + .useContext(ctx) + .useContextBy(_ => ctx) + .useContextBy((_, _, _) => ctx) + + .useDebugValue("aaaaa") + .useDebugValueBy(_ => 321654) + .useDebugValueBy((_, _, _, _) => 987) + + .useReducer(add(0), 100) + .useReducerBy((p, _, _, _, _) => add(p), _ + _ + _ + _ + _.value) + .useReducerBy($ => add($.hook4.value), $ => $.props + $.hook4.value + $.hook5.value) + + .renderRR { (_, a, b, c, d, e, f) => + val sum = a + b + c + d.value + e.value + f.value + sum + } +} diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala index 0d7636e0e..e5b6e4582 100644 --- a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala @@ -17,6 +17,7 @@ object Main { CustomHooks .Component(0), CustomHooksBy .Component(0), HooksPrimative .Component(), + HooksTrivial .Component(0), HooksWithChildrenCtxFn .Component(0)(<.div), HooksWithChildrenCtxObj .Component(0)(<.div), HooksWithJsFns .Component(0), diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out2.js new file mode 100644 index 000000000..0fc0ed32c --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out2.js @@ -0,0 +1,165 @@ +'use strict'; + +var _s = $RefreshSig$(); + +import * as $i_react from "react"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReact$0024 from "./japgolly.scalajs.react.React$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002efeature$002eContext$0024$0024anon$00243 from "./japgolly.scalajs.react.feature.Context$$anon$3.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P5 from "./japgolly.scalajs.react.hooks.HookCtx$P5.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer from "./japgolly.scalajs.react.hooks.Hooks$UseReducer.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseReducer$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 from "./japgolly.scalajs.react.internal.Singleton$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eClassCastException from "./java.lang.ClassCastException.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002eFunction1 from "./scala.Function1.js"; +import * as $j_scala$002escalajs$002ejs$002eAny$0024 from "./scala.scalajs.js.Any$.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction2 from "./scala.scalajs.runtime.AnonFunction2.js"; + +function $p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2($thiz, n) { + return new $j_scala$002escalajs$002eruntime$002eAnonFunction2.$c_sjsr_AnonFunction2((n$1 => (x$1$2, x$2$2) => { + var x$1 = x$1$2 | 0; + var x$2 = x$2$2 | 0; + return (x$1 + x$2 | 0) + n$1 | 0; + })(n)); +} + +export { $p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2 }; + +function $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$() { + this.Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_ctx = null; + this.Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_Component = null; + $n_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$ = this; + var this$1 = $j_japgolly$002escalajs$002ereact$002eReact$0024.$m_Ljapgolly_scalajs_react_React$(); + this.Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_ctx = new $j_japgolly$002escalajs$002ereact$002efeature$002eContext$0024$0024anon$00243.$c_Ljapgolly_scalajs_react_feature_Context$$anon$3(100); + + var rawComponent = arg1$2 => $m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$().japgolly$scalajs$react$test$emissions$HooksTrivial$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2); + + var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$3 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$(), null)); + this.Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$3.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$ }; +$c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$; + +function $h_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$ }; +$h_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$.prototype; + +$c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$.prototype.japgolly$scalajs$react$test$emissions$HooksTrivial$$$anonfun$Component$6__N__Ljapgolly_scalajs_react_internal_Box__I__I__I__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__I = function (x$5, props$1, hook1$1, hook2$1, hook3$1, hook7$1) { + return ((((props$1.a | 0) + hook1$1 | 0) + hook2$1 | 0) + hook3$1 | 0) + (hook7$1.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0; +}; + +$c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$.prototype.japgolly$scalajs$react$test$emissions$HooksTrivial$$$anonfun$Component$7__N__Ljapgolly_scalajs_react_hooks_HookCtx$P5__I = function (x$6, hook9_ctx$1) { + var $$x2 = hook9_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + var this$1 = hook9_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P4__f_hook4; + var $$x1 = this$1.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0]; + var this$2 = hook9_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P5__f_hook5; + return (($$x2 | 0) + ($$x1 | 0) | 0) + (this$2.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0; +}; + +$c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$.prototype.japgolly$scalajs$react$test$emissions$HooksTrivial$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s(function (props) { + _s(); + + var hook1_context = $m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$().Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_ctx; + var hook1 = $i_react.useContext(hook1_context.Ljapgolly_scalajs_react_feature_Context$$anon$3__f_raw) | 0; + props.a; + var hook2_context = $m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$().Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_ctx; + var hook2 = $i_react.useContext(hook2_context.Ljapgolly_scalajs_react_feature_Context$$anon$3__f_raw) | 0; + var hook3_context = $m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$().Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_ctx; + var hook3 = $i_react.useContext(hook3_context.Ljapgolly_scalajs_react_feature_Context$$anon$3__f_raw) | 0; + $i_react.useDebugValue(null, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$1$2 => { + if (x$1$2 !== null) { + throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); + } + + ; + return "aaaaa"; + })); + props.a; + $i_react.useDebugValue(null, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$2$2 => { + if (x$2$2 !== null) { + throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); + } + + ; + return 321654; + })); + $i_react.useDebugValue(null, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$3$2 => { + if (x$3$2 !== null) { + throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); + } + + ; + return 987; + })); + var hook7_raw = $i_react.useReducer($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().fromFunction2__F2__sjs_js_Function2($p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2($m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$(), 0)), null, arg1$2 => { + if (arg1$2 !== null) { + throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); + } + + ; + $m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$(); + return 100; + }); + var hook7 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseReducer$().fromJs__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer(hook7_raw); + var hook8_raw = $i_react.useReducer($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().fromFunction2__F2__sjs_js_Function2($p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2($m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$(), props.a | 0)), null, ((props$1$1, hook1$1, hook2$1, hook3$1, hook7$1) => arg1$2$1 => { + if (arg1$2$1 !== null) { + throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); + } + + ; + var arg1$1 = null; + return $m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$().japgolly$scalajs$react$test$emissions$HooksTrivial$$$anonfun$Component$6__N__Ljapgolly_scalajs_react_internal_Box__I__I__I__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__I(arg1$1, props$1$1, hook1$1, hook2$1, hook3$1, hook7$1); + })(props, hook1, hook2, hook3, hook7)); + var hook8 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseReducer$().fromJs__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer(hook8_raw); + var props$3 = props.a; + var hook9_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P5.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P5(props$3, hook1, hook2, hook3, hook7, hook8); + var $$x3 = $i_react; + var $$x2 = $j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$(); + var $$x1 = $m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$(); + var this$5 = hook9_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P4__f_hook4; + var hook9_raw = $$x3.useReducer($$x2.fromFunction2__F2__sjs_js_Function2($p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2($$x1, this$5.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0)), null, (hook9_ctx$1 => arg1$2$2 => { + if (arg1$2$2 !== null) { + throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); + } + + ; + var arg1$3 = null; + return $m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$().japgolly$scalajs$react$test$emissions$HooksTrivial$$$anonfun$Component$7__N__Ljapgolly_scalajs_react_hooks_HookCtx$P5__I(arg1$3, hook9_ctx$1); + })(hook9_ctx)); + var hook9 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseReducer$().fromJs__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer(hook9_raw); + var sum = ((((hook1 + hook2 | 0) + hook3 | 0) + (hook7.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0) + (hook8.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0) + (hook9.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0; + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + return new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; +}, "zl82e0xbdVDV2cVfnLQXAL1/XBw="); +var $d_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_HooksTrivial$: 0 +}, false, "japgolly.scalajs.react.test.emissions.HooksTrivial$", { + Ljapgolly_scalajs_react_test_emissions_HooksTrivial$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$ }; +$c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$; +var $n_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$; + +function $m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$) { + $n_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$ = new $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out3.js new file mode 100644 index 000000000..1afcee666 --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out3.js @@ -0,0 +1,156 @@ +'use strict'; + +import * as $i_react from "react"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReact$0024 from "./japgolly.scalajs.react.React$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002efeature$002eContext$0024$0024anon$00243 from "./japgolly.scalajs.react.feature.Context$$anon$3.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P5 from "./japgolly.scalajs.react.hooks.HookCtx$P5.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer from "./japgolly.scalajs.react.hooks.Hooks$UseReducer.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseReducer$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eClassCastException from "./java.lang.ClassCastException.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002eFunction1 from "./scala.Function1.js"; +import * as $j_scala$002escalajs$002ejs$002eAny$0024 from "./scala.scalajs.js.Any$.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction2 from "./scala.scalajs.runtime.AnonFunction2.js"; + +function $p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2($thiz, n) { + return new $j_scala$002escalajs$002eruntime$002eAnonFunction2.$c_sjsr_AnonFunction2((n$2 => (_$1, _$2) => { + var _$1$1 = _$1 | 0; + + var _$2$1 = _$2 | 0; + + return (_$1$1 + _$2$1 | 0) + n$2 | 0; + })(n)); +} + +export { $p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2 }; + +function $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$() { + this.Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_ctx = null; + this.Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_Component = null; + $n_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$ = this; + var this$1 = $j_japgolly$002escalajs$002ereact$002eReact$0024.$m_Ljapgolly_scalajs_react_React$(); + this.Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_ctx = new $j_japgolly$002escalajs$002ereact$002efeature$002eContext$0024$0024anon$00243.$c_Ljapgolly_scalajs_react_feature_Context$$anon$3(100); + + var rawComponent = (this$3 => { + var _s = $RefreshSig$(); + + return _s(props => { + _s(); + + var hook1 = $i_react.useContext(this$3.Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_ctx.Ljapgolly_scalajs_react_feature_Context$$anon$3__f_raw) | 0; + props.a; + var hook2 = $i_react.useContext(this$3.Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_ctx.Ljapgolly_scalajs_react_feature_Context$$anon$3__f_raw) | 0; + var hook3 = $i_react.useContext((props.a | 0, this$3.Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_ctx.Ljapgolly_scalajs_react_feature_Context$$anon$3__f_raw)) | 0; + $i_react.useDebugValue(null, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$20 => { + if (_$20 !== null) { + throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); + } + + ; + return "aaaaa"; + })); + props.a; + $i_react.useDebugValue(null, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$20$2 => { + if (_$20$2 !== null) { + throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); + } + + ; + return 321654; + })); + $i_react.useDebugValue(null, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$20$3 => { + if (_$20$3 !== null) { + throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); + } + + ; + return 987; + })); + var hook7_raw = $i_react.useReducer($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().fromFunction2__F2__sjs_js_Function2($p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2(this$3, 0)), null, _$21 => { + if (_$21 !== null) { + throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); + } + + ; + return 100; + }); + var hook7 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseReducer$().fromJs__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer(hook7_raw); + var $$x2 = $i_react; + var $$x1 = $j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$(); + var p = props.a | 0; + var hook8_raw = $$x2.useReducer($$x1.fromFunction2__F2__sjs_js_Function2($p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2(this$3, p)), null, ((props$2$1, hook1$2, hook2$2, hook3$2, hook7$2) => _$21$2 => { + if (_$21$2 !== null) { + throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); + } + + ; + + var _$16 = props$2$1.a | 0; + + return (((_$16 + hook1$2 | 0) + hook2$2 | 0) + hook3$2 | 0) + (hook7$2.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0; + })(props, hook1, hook2, hook3, hook7)); + var hook8 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseReducer$().fromJs__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer(hook8_raw); + var props$3 = props.a; + var hook9_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P5.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P5(props$3, hook1, hook2, hook3, hook7, hook8); + var $$x4 = $i_react; + var $$x3 = $j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$(); + var this$8 = hook9_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P4__f_hook4; + var hook9_raw = $$x4.useReducer($$x3.fromFunction2__F2__sjs_js_Function2($p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2(this$3, this$8.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0)), null, (hook9_ctx$2 => _$21$3 => { + if (_$21$3 !== null) { + throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); + } + + ; + var $$x6 = hook9_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + var this$9 = hook9_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P4__f_hook4; + var $$x5 = this$9.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0]; + var this$10 = hook9_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P5__f_hook5; + return (($$x6 | 0) + ($$x5 | 0) | 0) + (this$10.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0; + })(hook9_ctx)); + var hook9 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseReducer$().fromJs__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer(hook9_raw); + props.a | 0; + var sum = ((((hook1 + hook2 | 0) + hook3 | 0) + (hook7.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0) + (hook8.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0) + (hook9.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0; + return ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; + }, "zl82e0xbdVDV2cVfnLQXAL1/XBw="); + })(this); + + var $$x7 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$13 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); + this.Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_Component = $$x7.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$13.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$ }; +$c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$; + +function $h_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$ }; +$h_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$.prototype; +var $d_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_HooksTrivial$: 0 +}, false, "japgolly.scalajs.react.test.emissions.HooksTrivial$", { + Ljapgolly_scalajs_react_test_emissions_HooksTrivial$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$ }; +$c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$; +var $n_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$; + +function $m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$) { + $n_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$ = new $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$ }; diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala index 5d2a3f432..e0965953e 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala @@ -27,6 +27,7 @@ object ReactRefreshTest extends TestSuite { "CustomHooks" - testScala(assertRR = false) // TODO: "CustomHooksBy" - testScala(assertRR = false) // TODO: "HooksPrimative" - testScala(assertRR = false) // TODO: + "HooksTrivial" - testScala() "HooksWithChildrenCtxFn" - testScala() "HooksWithChildrenCtxObj" - testScala() "HooksWithJsFns" - testScala() From 2fb130a7e08c16b70513229a972ab6f688beabb0 Mon Sep 17 00:00:00 2001 From: David Barri Date: Wed, 22 Jun 2022 16:38:00 +1000 Subject: [PATCH 61/72] Avoid shadowing in Scala 2 --- .../react/hooks/AbstractHookMacros.scala | 7 +- .../test/resources/rr-sjr/CustomHooks-out2.js | 13 +- .../test/resources/rr-sjr/CustomHooks-out3.js | 12 +- .../resources/rr-sjr/CustomHooksBy-out2.js | 21 ++- .../resources/rr-sjr/CustomHooksBy-out3.js | 23 +++- .../resources/rr-sjr/HooksPrimative-out2.js | 65 ++++++---- .../resources/rr-sjr/HooksPrimative-out3.js | 53 ++++---- .../resources/rr-sjr/HooksTrivial-out2.js | 63 +++++---- .../resources/rr-sjr/HooksTrivial-out3.js | 53 +++++--- .../rr-sjr/HooksWithChildrenCtxFn-out2.js | 17 ++- .../rr-sjr/HooksWithChildrenCtxFn-out3.js | 17 ++- .../rr-sjr/HooksWithChildrenCtxObj-out2.js | 11 +- .../rr-sjr/HooksWithChildrenCtxObj-out3.js | 11 +- .../resources/rr-sjr/HooksWithJsFns-out2.js | 34 +++-- .../resources/rr-sjr/HooksWithJsFns-out3.js | 26 ++-- .../rr-sjr/HooksWithScalaFns-out2.js | 44 ++++--- .../rr-sjr/HooksWithScalaFns-out3.js | 36 ++++-- .../test/resources/rr-sjr/UseCallback-out2.js | 48 ++++--- .../test/resources/rr-sjr/UseCallback-out3.js | 60 ++++++--- .../src/test/resources/rr-sjr/UseMemo-out2.js | 122 +++++++++++------- .../src/test/resources/rr-sjr/UseMemo-out3.js | 107 +++++++++------ .../test/resources/rr-sjr/UseState-out2.js | 44 ++++--- .../test/resources/rr-sjr/UseState-out3.js | 44 ++++--- .../rr-sjr/UseStateWithReuse-out2.js | 59 +++++---- .../rr-sjr/UseStateWithReuse-out3.js | 59 +++++---- 25 files changed, 651 insertions(+), 398 deletions(-) diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala index 48e4867af..38aeb5348 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala @@ -54,6 +54,9 @@ object AbstractHookMacros { // =================================================================================================================== // Hook Rewriter + // Avoid shadowing in Scala 2. + final val hookValPrefix = "__japgolly__" + sealed trait HookRewriter[Stmt, Term <: Stmt, Ref] { val bridge : HookRewriter.Bridge[Stmt, Term, Ref] protected val hookNo : Int @@ -68,9 +71,9 @@ object AbstractHookMacros { // Don't make this an eager val. It depends on `val hookNo` protected def hookName = if (hookNo < 0) - "render" + hookValPrefix + "render" else - "hook" + hookNo + hookValPrefix + "hook" + hookNo final def +=(stmt: Stmt): Unit = _stmts :+= stmt diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out2.js index 455654813..e213bedcc 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out2.js @@ -75,11 +75,16 @@ $h_Ljapgolly_scalajs_react_test_emissions_CustomHooks$.prototype = $c_Ljapgolly_ $c_Ljapgolly_scalajs_react_test_emissions_CustomHooks$.prototype.japgolly$scalajs$react$test$emissions$CustomHooks$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = function (props) { var this$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Arg$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$Arg$().exactId__F1(); var v1 = props.a | 0; - var hook1_arg = this$1.apply__O__O(v1) | 0; - var hook1 = $m_Ljapgolly_scalajs_react_test_emissions_CustomHooks$().Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook1.apply__O__O(hook1_arg); + + var __japgolly__hook1_arg = this$1.apply__O__O(v1) | 0; + + var __japgolly__hook1 = $m_Ljapgolly_scalajs_react_test_emissions_CustomHooks$().Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook1.apply__O__O(__japgolly__hook1_arg); + $m_Ljapgolly_scalajs_react_test_emissions_CustomHooks$().Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook2.apply__O__O(void 0); - var hook3 = $m_Ljapgolly_scalajs_react_test_emissions_CustomHooks$().Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook3.apply__O__O(void 0); - var sum = ((props.a | 0) + (hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (hook3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0; + + var __japgolly__hook3 = $m_Ljapgolly_scalajs_react_test_emissions_CustomHooks$().Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook3.apply__O__O(void 0); + + var sum = ((props.a | 0) + (__japgolly__hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0; var $$x1 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out3.js index 0dc8994dd..b164d5b9d 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out3.js @@ -63,12 +63,16 @@ function $c_Ljapgolly_scalajs_react_test_emissions_CustomHooks$() { })); var rawComponent = (this$6$1 => props => { - var hook1_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Arg$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$Arg$().exactId__F1().apply__O__O(props.a) | 0; - var hook1 = this$6$1.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook1.apply__O__O(hook1_arg); + var __japgolly__hook1_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Arg$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$Arg$().exactId__F1().apply__O__O(props.a) | 0; + + var __japgolly__hook1 = this$6$1.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook1.apply__O__O(__japgolly__hook1_arg); + this$6$1.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook2.apply__O__O(void 0); - var hook3 = this$6$1.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook3.apply__O__O(void 0); + + var __japgolly__hook3 = this$6$1.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook3.apply__O__O(void 0); + var p = props.a | 0; - var sum = (p + (hook1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (hook3.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; + var sum = (p + (__japgolly__hook1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook3.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; var this$17 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out2.js index b605ce568..efba16d2d 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out2.js @@ -76,14 +76,21 @@ export { $h_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$ }; $h_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$.prototype; $c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$.prototype.japgolly$scalajs$react$test$emissions$CustomHooksBy$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = function (props) { - var hook1_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1($m_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$().Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook1, -1 + (props.a | 0) | 0); - var hook1 = hook1_raw.apply__O__O(void 0); - var hook2_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1($m_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$().Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook2, hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]); - var hook2 = hook2_raw.apply__O__O(void 0); + var __japgolly__hook1_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1($m_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$().Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook1, -1 + (props.a | 0) | 0); + + var __japgolly__hook1 = __japgolly__hook1_raw.apply__O__O(void 0); + + var __japgolly__hook2_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1($m_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$().Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook2, __japgolly__hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]); + + var __japgolly__hook2 = __japgolly__hook2_raw.apply__O__O(void 0); + props.a; - var hook3_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1($m_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$().Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook3, hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]); - var hook3 = hook3_raw.apply__O__O(void 0); - var sum = (((props.a | 0) + (hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (hook3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0; + + var __japgolly__hook3_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1($m_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$().Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook3, __japgolly__hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]); + + var __japgolly__hook3 = __japgolly__hook3_raw.apply__O__O(void 0); + + var sum = (((props.a | 0) + (__japgolly__hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0; var $$x1 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out3.js index 9151e0b18..e69ac1101 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out3.js @@ -63,16 +63,25 @@ function $c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$() { var rawComponent = (this$7$1 => props => { var p = props.a | 0; - var hook1_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1(this$7$1.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook1, -1 + p | 0); - var hook1 = hook1_raw.apply__O__O(void 0); + + var __japgolly__hook1_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1(this$7$1.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook1, -1 + p | 0); + + var __japgolly__hook1 = __japgolly__hook1_raw.apply__O__O(void 0); + props.a | 0; - var hook2_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1(this$7$1.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook2, hook1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); - var hook2 = hook2_raw.apply__O__O(void 0); + + var __japgolly__hook2_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1(this$7$1.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook2, __japgolly__hook1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); + + var __japgolly__hook2 = __japgolly__hook2_raw.apply__O__O(void 0); + props.a; - var hook3_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1(this$7$1.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook3, hook2.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); - var hook3 = hook3_raw.apply__O__O(void 0); + + var __japgolly__hook3_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1(this$7$1.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook3, __japgolly__hook2.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); + + var __japgolly__hook3 = __japgolly__hook3_raw.apply__O__O(void 0); + var p$2 = props.a | 0; - var sum = ((p$2 + (hook1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (hook2.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (hook3.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; + var sum = ((p$2 + (__japgolly__hook1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook2.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook3.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; var this$15 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksPrimative-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksPrimative-out2.js index fe4d0a3b8..fe143f7b6 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksPrimative-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksPrimative-out2.js @@ -13,56 +13,56 @@ import * as $j_java$002elang$002eNullPointerException from "./java.lang.NullPoin import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; import * as $j_scala$002eruntime$002eLazyInt from "./scala.runtime.LazyInt.js"; -function $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook4_raw$lzycompute$1__sr_LazyInt__I($thiz, hook4_raw$lzy$1) { - if (hook4_raw$lzy$1 === null) { +function $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$____japgolly__hook4_raw$lzycompute$1__sr_LazyInt__I($thiz, __japgolly__hook4_raw$lzy$1) { + if (__japgolly__hook4_raw$lzy$1 === null) { throw new $j_java$002elang$002eNullPointerException.$c_jl_NullPointerException(); } ; - return hook4_raw$lzy$1.sr_LazyInt__f__initialized ? hook4_raw$lzy$1.sr_LazyInt__f__value : hook4_raw$lzy$1.initialize__I__I(4444); + return __japgolly__hook4_raw$lzy$1.sr_LazyInt__f__initialized ? __japgolly__hook4_raw$lzy$1.sr_LazyInt__f__value : __japgolly__hook4_raw$lzy$1.initialize__I__I(4444); } -export { $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook4_raw$lzycompute$1__sr_LazyInt__I }; +export { $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$____japgolly__hook4_raw$lzycompute$1__sr_LazyInt__I }; -function $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook4_raw$1__sr_LazyInt__I($thiz, hook4_raw$lzy$1) { - return hook4_raw$lzy$1.sr_LazyInt__f__initialized ? hook4_raw$lzy$1.sr_LazyInt__f__value : $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook4_raw$lzycompute$1__sr_LazyInt__I($thiz, hook4_raw$lzy$1); +function $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$____japgolly__hook4_raw$1__sr_LazyInt__I($thiz, __japgolly__hook4_raw$lzy$1) { + return __japgolly__hook4_raw$lzy$1.sr_LazyInt__f__initialized ? __japgolly__hook4_raw$lzy$1.sr_LazyInt__f__value : $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$____japgolly__hook4_raw$lzycompute$1__sr_LazyInt__I($thiz, __japgolly__hook4_raw$lzy$1); } -export { $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook4_raw$1__sr_LazyInt__I }; +export { $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$____japgolly__hook4_raw$1__sr_LazyInt__I }; -function $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook5_raw$lzycompute$1__sr_LazyInt__I($thiz, hook5_raw$lzy$1) { - if (hook5_raw$lzy$1 === null) { +function $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$____japgolly__hook5_raw$lzycompute$1__sr_LazyInt__I($thiz, __japgolly__hook5_raw$lzy$1) { + if (__japgolly__hook5_raw$lzy$1 === null) { throw new $j_java$002elang$002eNullPointerException.$c_jl_NullPointerException(); } ; - return hook5_raw$lzy$1.sr_LazyInt__f__initialized ? hook5_raw$lzy$1.sr_LazyInt__f__value : hook5_raw$lzy$1.initialize__I__I(5555); + return __japgolly__hook5_raw$lzy$1.sr_LazyInt__f__initialized ? __japgolly__hook5_raw$lzy$1.sr_LazyInt__f__value : __japgolly__hook5_raw$lzy$1.initialize__I__I(5555); } -export { $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook5_raw$lzycompute$1__sr_LazyInt__I }; +export { $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$____japgolly__hook5_raw$lzycompute$1__sr_LazyInt__I }; -function $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook5_raw$1__sr_LazyInt__I($thiz, hook5_raw$lzy$1) { - return hook5_raw$lzy$1.sr_LazyInt__f__initialized ? hook5_raw$lzy$1.sr_LazyInt__f__value : $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook5_raw$lzycompute$1__sr_LazyInt__I($thiz, hook5_raw$lzy$1); +function $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$____japgolly__hook5_raw$1__sr_LazyInt__I($thiz, __japgolly__hook5_raw$lzy$1) { + return __japgolly__hook5_raw$lzy$1.sr_LazyInt__f__initialized ? __japgolly__hook5_raw$lzy$1.sr_LazyInt__f__value : $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$____japgolly__hook5_raw$lzycompute$1__sr_LazyInt__I($thiz, __japgolly__hook5_raw$lzy$1); } -export { $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook5_raw$1__sr_LazyInt__I }; +export { $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$____japgolly__hook5_raw$1__sr_LazyInt__I }; -function $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook6_raw$lzycompute$1__sr_LazyInt__I($thiz, hook6_raw$lzy$1) { - if (hook6_raw$lzy$1 === null) { +function $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$____japgolly__hook6_raw$lzycompute$1__sr_LazyInt__I($thiz, __japgolly__hook6_raw$lzy$1) { + if (__japgolly__hook6_raw$lzy$1 === null) { throw new $j_java$002elang$002eNullPointerException.$c_jl_NullPointerException(); } ; - return hook6_raw$lzy$1.sr_LazyInt__f__initialized ? hook6_raw$lzy$1.sr_LazyInt__f__value : hook6_raw$lzy$1.initialize__I__I(6666); + return __japgolly__hook6_raw$lzy$1.sr_LazyInt__f__initialized ? __japgolly__hook6_raw$lzy$1.sr_LazyInt__f__value : __japgolly__hook6_raw$lzy$1.initialize__I__I(6666); } -export { $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook6_raw$lzycompute$1__sr_LazyInt__I }; +export { $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$____japgolly__hook6_raw$lzycompute$1__sr_LazyInt__I }; -function $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook6_raw$1__sr_LazyInt__I($thiz, hook6_raw$lzy$1) { - return hook6_raw$lzy$1.sr_LazyInt__f__initialized ? hook6_raw$lzy$1.sr_LazyInt__f__value : $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook6_raw$lzycompute$1__sr_LazyInt__I($thiz, hook6_raw$lzy$1); +function $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$____japgolly__hook6_raw$1__sr_LazyInt__I($thiz, __japgolly__hook6_raw$lzy$1) { + return __japgolly__hook6_raw$lzy$1.sr_LazyInt__f__initialized ? __japgolly__hook6_raw$lzy$1.sr_LazyInt__f__value : $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$____japgolly__hook6_raw$lzycompute$1__sr_LazyInt__I($thiz, __japgolly__hook6_raw$lzy$1); } -export { $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook6_raw$1__sr_LazyInt__I }; +export { $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$____japgolly__hook6_raw$1__sr_LazyInt__I }; function $c_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$() { this.Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__f_Component = null; @@ -86,22 +86,31 @@ export { $h_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$ }; $h_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$.prototype; $c_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$.prototype.japgolly$scalajs$react$test$emissions$HooksPrimative$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = function (props) { - var hook4_raw$lzy = new $j_scala$002eruntime$002eLazyInt.$c_sr_LazyInt(); - var hook5_raw$lzy = new $j_scala$002eruntime$002eLazyInt.$c_sr_LazyInt(); - var hook6_raw$lzy = new $j_scala$002eruntime$002eLazyInt.$c_sr_LazyInt(); + var __japgolly__hook4_raw$lzy = new $j_scala$002eruntime$002eLazyInt.$c_sr_LazyInt(); + + var __japgolly__hook5_raw$lzy = new $j_scala$002eruntime$002eLazyInt.$c_sr_LazyInt(); + + var __japgolly__hook6_raw$lzy = new $j_scala$002eruntime$002eLazyInt.$c_sr_LazyInt(); + props.a; props.a; var this$4 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); - var hook7 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024VarF.$c_Ljapgolly_scalajs_react_hooks_Hooks$VarF(7777, this$4.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + + var __japgolly__hook7 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024VarF.$c_Ljapgolly_scalajs_react_hooks_Hooks$VarF(7777, this$4.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + props.a; var this$7 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); - var hook8 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024VarF.$c_Ljapgolly_scalajs_react_hooks_Hooks$VarF(8888, this$7.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + + var __japgolly__hook8 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024VarF.$c_Ljapgolly_scalajs_react_hooks_Hooks$VarF(8888, this$7.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + var this$9 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); - var hook9 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024VarF.$c_Ljapgolly_scalajs_react_hooks_Hooks$VarF(9999, this$9.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + + var __japgolly__hook9 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024VarF.$c_Ljapgolly_scalajs_react_hooks_Hooks$VarF(9999, this$9.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + console.log("aaaaa"); props.a; console.log("ccccc"); - var sum = ((((((6666 + $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook4_raw$1__sr_LazyInt__I(this, hook4_raw$lzy) | 0) + $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook5_raw$1__sr_LazyInt__I(this, hook5_raw$lzy) | 0) + $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook6_raw$1__sr_LazyInt__I(this, hook6_raw$lzy) | 0) + (hook7.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + (hook8.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + (hook9.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + ("bbbbb".length | 0) | 0; + var sum = ((((((6666 + $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$____japgolly__hook4_raw$1__sr_LazyInt__I(this, __japgolly__hook4_raw$lzy) | 0) + $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$____japgolly__hook5_raw$1__sr_LazyInt__I(this, __japgolly__hook5_raw$lzy) | 0) + $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$____japgolly__hook6_raw$1__sr_LazyInt__I(this, __japgolly__hook6_raw$lzy) | 0) + (__japgolly__hook7.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + (__japgolly__hook8.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + (__japgolly__hook9.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + ("bbbbb".length | 0) | 0; $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); return new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksPrimative-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksPrimative-out3.js index 428bbe70e..365448927 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksPrimative-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksPrimative-out3.js @@ -13,39 +13,39 @@ import * as $j_java$002elang$002eNullPointerException from "./java.lang.NullPoin import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; import * as $j_scala$002eruntime$002eLazyInt from "./scala.runtime.LazyInt.js"; -function $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook5_raw$lzyINIT1$1__sr_LazyInt__I($thiz, hook5_raw$lzy1$1) { - if (hook5_raw$lzy1$1 === null) { +function $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$____japgolly__hook5_raw$lzyINIT1$1__sr_LazyInt__I($thiz, __japgolly__hook5_raw$lzy1$1) { + if (__japgolly__hook5_raw$lzy1$1 === null) { throw new $j_java$002elang$002eNullPointerException.$c_jl_NullPointerException(); } ; - return hook5_raw$lzy1$1.sr_LazyInt__f__initialized ? hook5_raw$lzy1$1.sr_LazyInt__f__value : hook5_raw$lzy1$1.initialize__I__I(5555); + return __japgolly__hook5_raw$lzy1$1.sr_LazyInt__f__initialized ? __japgolly__hook5_raw$lzy1$1.sr_LazyInt__f__value : __japgolly__hook5_raw$lzy1$1.initialize__I__I(5555); } -export { $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook5_raw$lzyINIT1$1__sr_LazyInt__I }; +export { $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$____japgolly__hook5_raw$lzyINIT1$1__sr_LazyInt__I }; -function $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook5_raw$1__sr_LazyInt__I($thiz, hook5_raw$lzy1$2) { - return hook5_raw$lzy1$2.sr_LazyInt__f__initialized ? hook5_raw$lzy1$2.sr_LazyInt__f__value : $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook5_raw$lzyINIT1$1__sr_LazyInt__I($thiz, hook5_raw$lzy1$2); +function $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$____japgolly__hook5_raw$1__sr_LazyInt__I($thiz, __japgolly__hook5_raw$lzy1$2) { + return __japgolly__hook5_raw$lzy1$2.sr_LazyInt__f__initialized ? __japgolly__hook5_raw$lzy1$2.sr_LazyInt__f__value : $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$____japgolly__hook5_raw$lzyINIT1$1__sr_LazyInt__I($thiz, __japgolly__hook5_raw$lzy1$2); } -export { $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook5_raw$1__sr_LazyInt__I }; +export { $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$____japgolly__hook5_raw$1__sr_LazyInt__I }; -function $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook6_raw$lzyINIT1$1__sr_LazyInt__I($thiz, hook6_raw$lzy1$1) { - if (hook6_raw$lzy1$1 === null) { +function $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$____japgolly__hook6_raw$lzyINIT1$1__sr_LazyInt__I($thiz, __japgolly__hook6_raw$lzy1$1) { + if (__japgolly__hook6_raw$lzy1$1 === null) { throw new $j_java$002elang$002eNullPointerException.$c_jl_NullPointerException(); } ; - return hook6_raw$lzy1$1.sr_LazyInt__f__initialized ? hook6_raw$lzy1$1.sr_LazyInt__f__value : hook6_raw$lzy1$1.initialize__I__I(6666); + return __japgolly__hook6_raw$lzy1$1.sr_LazyInt__f__initialized ? __japgolly__hook6_raw$lzy1$1.sr_LazyInt__f__value : __japgolly__hook6_raw$lzy1$1.initialize__I__I(6666); } -export { $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook6_raw$lzyINIT1$1__sr_LazyInt__I }; +export { $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$____japgolly__hook6_raw$lzyINIT1$1__sr_LazyInt__I }; -function $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook6_raw$1__sr_LazyInt__I($thiz, hook6_raw$lzy1$2) { - return hook6_raw$lzy1$2.sr_LazyInt__f__initialized ? hook6_raw$lzy1$2.sr_LazyInt__f__value : $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook6_raw$lzyINIT1$1__sr_LazyInt__I($thiz, hook6_raw$lzy1$2); +function $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$____japgolly__hook6_raw$1__sr_LazyInt__I($thiz, __japgolly__hook6_raw$lzy1$2) { + return __japgolly__hook6_raw$lzy1$2.sr_LazyInt__f__initialized ? __japgolly__hook6_raw$lzy1$2.sr_LazyInt__f__value : $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$____japgolly__hook6_raw$lzyINIT1$1__sr_LazyInt__I($thiz, __japgolly__hook6_raw$lzy1$2); } -export { $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook6_raw$1__sr_LazyInt__I }; +export { $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$____japgolly__hook6_raw$1__sr_LazyInt__I }; function $c_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$() { this.Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__f_Component = null; @@ -53,25 +53,34 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$() { var rawComponent = (this$1 => props => { new $j_scala$002eruntime$002eLazyInt.$c_sr_LazyInt(); - var hook5_raw$lzy1 = new $j_scala$002eruntime$002eLazyInt.$c_sr_LazyInt(); - var hook6_raw$lzy1 = new $j_scala$002eruntime$002eLazyInt.$c_sr_LazyInt(); + + var __japgolly__hook5_raw$lzy1 = new $j_scala$002eruntime$002eLazyInt.$c_sr_LazyInt(); + + var __japgolly__hook6_raw$lzy1 = new $j_scala$002eruntime$002eLazyInt.$c_sr_LazyInt(); + props.a; props.a; - var hook5_raw$lzy1$2 = hook5_raw$lzy1; - var hook6_raw$lzy1$2 = hook6_raw$lzy1; + var __japgolly__hook5_raw$lzy1$2 = __japgolly__hook5_raw$lzy1; + var __japgolly__hook6_raw$lzy1$2 = __japgolly__hook6_raw$lzy1; var this$5 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); - var hook7 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024VarF.$c_Ljapgolly_scalajs_react_hooks_Hooks$VarF(7777, this$5.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + + var __japgolly__hook7 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024VarF.$c_Ljapgolly_scalajs_react_hooks_Hooks$VarF(7777, this$5.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + props.a; var this$8 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); - var hook8 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024VarF.$c_Ljapgolly_scalajs_react_hooks_Hooks$VarF(8888, this$8.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + + var __japgolly__hook8 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024VarF.$c_Ljapgolly_scalajs_react_hooks_Hooks$VarF(8888, this$8.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + var this$10 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); - var hook9 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024VarF.$c_Ljapgolly_scalajs_react_hooks_Hooks$VarF(9999, this$10.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + + var __japgolly__hook9 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024VarF.$c_Ljapgolly_scalajs_react_hooks_Hooks$VarF(9999, this$10.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + console.log("aaaaa"); props.a; props.a; console.log("ccccc"); props.a; - var sum = (((((11110 + $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook5_raw$1__sr_LazyInt__I(this$1, hook5_raw$lzy1$2) | 0) + $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__hook6_raw$1__sr_LazyInt__I(this$1, hook6_raw$lzy1$2) | 0) + (hook7.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + (hook8.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + (hook9.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + ("bbbbb".length | 0) | 0; + var sum = (((((11110 + $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$____japgolly__hook5_raw$1__sr_LazyInt__I(this$1, __japgolly__hook5_raw$lzy1$2) | 0) + $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$____japgolly__hook6_raw$1__sr_LazyInt__I(this$1, __japgolly__hook6_raw$lzy1$2) | 0) + (__japgolly__hook7.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + (__japgolly__hook8.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + (__japgolly__hook9.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + ("bbbbb".length | 0) | 0; return ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; })(this); diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out2.js index 0fc0ed32c..69131efd9 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out2.js @@ -55,28 +55,29 @@ function $h_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$() {} export { $h_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$ }; $h_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$.prototype; -$c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$.prototype.japgolly$scalajs$react$test$emissions$HooksTrivial$$$anonfun$Component$6__N__Ljapgolly_scalajs_react_internal_Box__I__I__I__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__I = function (x$5, props$1, hook1$1, hook2$1, hook3$1, hook7$1) { - return ((((props$1.a | 0) + hook1$1 | 0) + hook2$1 | 0) + hook3$1 | 0) + (hook7$1.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0; +$c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$.prototype.japgolly$scalajs$react$test$emissions$HooksTrivial$$$anonfun$Component$6__N__Ljapgolly_scalajs_react_internal_Box__I__I__I__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__I = function (x$5, props$1, __japgolly__hook1$1, __japgolly__hook2$1, __japgolly__hook3$1, __japgolly__hook7$1) { + return ((((props$1.a | 0) + __japgolly__hook1$1 | 0) + __japgolly__hook2$1 | 0) + __japgolly__hook3$1 | 0) + (__japgolly__hook7$1.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0; }; -$c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$.prototype.japgolly$scalajs$react$test$emissions$HooksTrivial$$$anonfun$Component$7__N__Ljapgolly_scalajs_react_hooks_HookCtx$P5__I = function (x$6, hook9_ctx$1) { - var $$x2 = hook9_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; - var this$1 = hook9_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P4__f_hook4; +$c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$.prototype.japgolly$scalajs$react$test$emissions$HooksTrivial$$$anonfun$Component$7__N__Ljapgolly_scalajs_react_hooks_HookCtx$P5__I = function (x$6, __japgolly__hook9_ctx$1) { + var $$x2 = __japgolly__hook9_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + var this$1 = __japgolly__hook9_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P4__f_hook4; var $$x1 = this$1.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0]; - var this$2 = hook9_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P5__f_hook5; + var this$2 = __japgolly__hook9_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P5__f_hook5; return (($$x2 | 0) + ($$x1 | 0) | 0) + (this$2.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0; }; $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$.prototype.japgolly$scalajs$react$test$emissions$HooksTrivial$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s(function (props) { _s(); - var hook1_context = $m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$().Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_ctx; - var hook1 = $i_react.useContext(hook1_context.Ljapgolly_scalajs_react_feature_Context$$anon$3__f_raw) | 0; + var __japgolly__hook1 = $i_react.useContext($m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$().Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_ctx.Ljapgolly_scalajs_react_feature_Context$$anon$3__f_raw) | 0; + props.a; - var hook2_context = $m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$().Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_ctx; - var hook2 = $i_react.useContext(hook2_context.Ljapgolly_scalajs_react_feature_Context$$anon$3__f_raw) | 0; - var hook3_context = $m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$().Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_ctx; - var hook3 = $i_react.useContext(hook3_context.Ljapgolly_scalajs_react_feature_Context$$anon$3__f_raw) | 0; + + var __japgolly__hook2 = $i_react.useContext($m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$().Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_ctx.Ljapgolly_scalajs_react_feature_Context$$anon$3__f_raw) | 0; + + var __japgolly__hook3 = $i_react.useContext($m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$().Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_ctx.Ljapgolly_scalajs_react_feature_Context$$anon$3__f_raw) | 0; + $i_react.useDebugValue(null, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$1$2 => { if (x$1$2 !== null) { throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); @@ -102,7 +103,8 @@ $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$.prototype.japgolly$scala ; return 987; })); - var hook7_raw = $i_react.useReducer($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().fromFunction2__F2__sjs_js_Function2($p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2($m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$(), 0)), null, arg1$2 => { + + var __japgolly__hook7_raw = $i_react.useReducer($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().fromFunction2__F2__sjs_js_Function2($p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2($m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$(), 0)), null, arg1$2 => { if (arg1$2 !== null) { throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); } @@ -111,38 +113,47 @@ $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$.prototype.japgolly$scala $m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$(); return 100; }); - var hook7 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseReducer$().fromJs__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer(hook7_raw); - var hook8_raw = $i_react.useReducer($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().fromFunction2__F2__sjs_js_Function2($p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2($m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$(), props.a | 0)), null, ((props$1$1, hook1$1, hook2$1, hook3$1, hook7$1) => arg1$2$1 => { + + var __japgolly__hook7 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseReducer$().fromJs__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer(__japgolly__hook7_raw); + + var __japgolly__hook8_raw = $i_react.useReducer($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().fromFunction2__F2__sjs_js_Function2($p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2($m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$(), props.a | 0)), null, ((props$1$1, __japgolly__hook1$1, __japgolly__hook2$1, __japgolly__hook3$1, __japgolly__hook7$1) => arg1$2$1 => { if (arg1$2$1 !== null) { throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); } ; var arg1$1 = null; - return $m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$().japgolly$scalajs$react$test$emissions$HooksTrivial$$$anonfun$Component$6__N__Ljapgolly_scalajs_react_internal_Box__I__I__I__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__I(arg1$1, props$1$1, hook1$1, hook2$1, hook3$1, hook7$1); - })(props, hook1, hook2, hook3, hook7)); - var hook8 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseReducer$().fromJs__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer(hook8_raw); + return $m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$().japgolly$scalajs$react$test$emissions$HooksTrivial$$$anonfun$Component$6__N__Ljapgolly_scalajs_react_internal_Box__I__I__I__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__I(arg1$1, props$1$1, __japgolly__hook1$1, __japgolly__hook2$1, __japgolly__hook3$1, __japgolly__hook7$1); + })(props, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3, __japgolly__hook7)); + + var __japgolly__hook8 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseReducer$().fromJs__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer(__japgolly__hook8_raw); + var props$3 = props.a; - var hook9_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P5.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P5(props$3, hook1, hook2, hook3, hook7, hook8); + + var __japgolly__hook9_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P5.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P5(props$3, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3, __japgolly__hook7, __japgolly__hook8); + var $$x3 = $i_react; var $$x2 = $j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$(); var $$x1 = $m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$(); - var this$5 = hook9_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P4__f_hook4; - var hook9_raw = $$x3.useReducer($$x2.fromFunction2__F2__sjs_js_Function2($p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2($$x1, this$5.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0)), null, (hook9_ctx$1 => arg1$2$2 => { + var this$5 = __japgolly__hook9_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P4__f_hook4; + + var __japgolly__hook9_raw = $$x3.useReducer($$x2.fromFunction2__F2__sjs_js_Function2($p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2($$x1, this$5.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0)), null, (__japgolly__hook9_ctx$1 => arg1$2$2 => { if (arg1$2$2 !== null) { throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); } ; var arg1$3 = null; - return $m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$().japgolly$scalajs$react$test$emissions$HooksTrivial$$$anonfun$Component$7__N__Ljapgolly_scalajs_react_hooks_HookCtx$P5__I(arg1$3, hook9_ctx$1); - })(hook9_ctx)); - var hook9 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseReducer$().fromJs__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer(hook9_raw); - var sum = ((((hook1 + hook2 | 0) + hook3 | 0) + (hook7.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0) + (hook8.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0) + (hook9.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0; + return $m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$().japgolly$scalajs$react$test$emissions$HooksTrivial$$$anonfun$Component$7__N__Ljapgolly_scalajs_react_hooks_HookCtx$P5__I(arg1$3, __japgolly__hook9_ctx$1); + })(__japgolly__hook9_ctx)); + + var __japgolly__hook9 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseReducer$().fromJs__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer(__japgolly__hook9_raw); + + var sum = ((((__japgolly__hook1 + __japgolly__hook2 | 0) + __japgolly__hook3 | 0) + (__japgolly__hook7.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0) + (__japgolly__hook8.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0) + (__japgolly__hook9.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0; $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); return new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; -}, "zl82e0xbdVDV2cVfnLQXAL1/XBw="); +}, "hviLnwV7rVkoQrGLOuNFxEV4+eM="); var $d_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$ = new $j_java$002elang$002eObject.$TypeData().initClass({ Ljapgolly_scalajs_react_test_emissions_HooksTrivial$: 0 }, false, "japgolly.scalajs.react.test.emissions.HooksTrivial$", { diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out3.js index 1afcee666..e38434672 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out3.js @@ -43,10 +43,14 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$() { return _s(props => { _s(); - var hook1 = $i_react.useContext(this$3.Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_ctx.Ljapgolly_scalajs_react_feature_Context$$anon$3__f_raw) | 0; + var __japgolly__hook1 = $i_react.useContext(this$3.Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_ctx.Ljapgolly_scalajs_react_feature_Context$$anon$3__f_raw) | 0; + props.a; - var hook2 = $i_react.useContext(this$3.Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_ctx.Ljapgolly_scalajs_react_feature_Context$$anon$3__f_raw) | 0; - var hook3 = $i_react.useContext((props.a | 0, this$3.Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_ctx.Ljapgolly_scalajs_react_feature_Context$$anon$3__f_raw)) | 0; + + var __japgolly__hook2 = $i_react.useContext(this$3.Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_ctx.Ljapgolly_scalajs_react_feature_Context$$anon$3__f_raw) | 0; + + var __japgolly__hook3 = $i_react.useContext((props.a | 0, this$3.Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_ctx.Ljapgolly_scalajs_react_feature_Context$$anon$3__f_raw)) | 0; + $i_react.useDebugValue(null, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$20 => { if (_$20 !== null) { throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); @@ -72,7 +76,8 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$() { ; return 987; })); - var hook7_raw = $i_react.useReducer($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().fromFunction2__F2__sjs_js_Function2($p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2(this$3, 0)), null, _$21 => { + + var __japgolly__hook7_raw = $i_react.useReducer($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().fromFunction2__F2__sjs_js_Function2($p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2(this$3, 0)), null, _$21 => { if (_$21 !== null) { throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); } @@ -80,11 +85,14 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$() { ; return 100; }); - var hook7 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseReducer$().fromJs__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer(hook7_raw); + + var __japgolly__hook7 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseReducer$().fromJs__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer(__japgolly__hook7_raw); + var $$x2 = $i_react; var $$x1 = $j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$(); var p = props.a | 0; - var hook8_raw = $$x2.useReducer($$x1.fromFunction2__F2__sjs_js_Function2($p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2(this$3, p)), null, ((props$2$1, hook1$2, hook2$2, hook3$2, hook7$2) => _$21$2 => { + + var __japgolly__hook8_raw = $$x2.useReducer($$x1.fromFunction2__F2__sjs_js_Function2($p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2(this$3, p)), null, ((props$2$1, __japgolly__hook1$2, __japgolly__hook2$2, __japgolly__hook3$2, __japgolly__hook7$2) => _$21$2 => { if (_$21$2 !== null) { throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); } @@ -93,31 +101,38 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$() { var _$16 = props$2$1.a | 0; - return (((_$16 + hook1$2 | 0) + hook2$2 | 0) + hook3$2 | 0) + (hook7$2.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0; - })(props, hook1, hook2, hook3, hook7)); - var hook8 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseReducer$().fromJs__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer(hook8_raw); + return (((_$16 + __japgolly__hook1$2 | 0) + __japgolly__hook2$2 | 0) + __japgolly__hook3$2 | 0) + (__japgolly__hook7$2.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0; + })(props, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3, __japgolly__hook7)); + + var __japgolly__hook8 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseReducer$().fromJs__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer(__japgolly__hook8_raw); + var props$3 = props.a; - var hook9_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P5.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P5(props$3, hook1, hook2, hook3, hook7, hook8); + + var __japgolly__hook9_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P5.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P5(props$3, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3, __japgolly__hook7, __japgolly__hook8); + var $$x4 = $i_react; var $$x3 = $j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$(); - var this$8 = hook9_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P4__f_hook4; - var hook9_raw = $$x4.useReducer($$x3.fromFunction2__F2__sjs_js_Function2($p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2(this$3, this$8.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0)), null, (hook9_ctx$2 => _$21$3 => { + var this$8 = __japgolly__hook9_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P4__f_hook4; + + var __japgolly__hook9_raw = $$x4.useReducer($$x3.fromFunction2__F2__sjs_js_Function2($p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2(this$3, this$8.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0)), null, (__japgolly__hook9_ctx$2 => _$21$3 => { if (_$21$3 !== null) { throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); } ; - var $$x6 = hook9_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; - var this$9 = hook9_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P4__f_hook4; + var $$x6 = __japgolly__hook9_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + var this$9 = __japgolly__hook9_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P4__f_hook4; var $$x5 = this$9.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0]; - var this$10 = hook9_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P5__f_hook5; + var this$10 = __japgolly__hook9_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P5__f_hook5; return (($$x6 | 0) + ($$x5 | 0) | 0) + (this$10.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0; - })(hook9_ctx)); - var hook9 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseReducer$().fromJs__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer(hook9_raw); + })(__japgolly__hook9_ctx)); + + var __japgolly__hook9 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseReducer$().fromJs__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer(__japgolly__hook9_raw); + props.a | 0; - var sum = ((((hook1 + hook2 | 0) + hook3 | 0) + (hook7.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0) + (hook8.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0) + (hook9.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0; + var sum = ((((__japgolly__hook1 + __japgolly__hook2 | 0) + __japgolly__hook3 | 0) + (__japgolly__hook7.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0) + (__japgolly__hook8.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0) + (__japgolly__hook9.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0; return ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; - }, "zl82e0xbdVDV2cVfnLQXAL1/XBw="); + }, "hviLnwV7rVkoQrGLOuNFxEV4+eM="); })(this); var $$x7 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxFn-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxFn-out2.js index 51df1d6bb..05e768bdd 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxFn-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxFn-out2.js @@ -49,26 +49,29 @@ $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$.prototype.japg _s(); var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$().fromRawProps__sjs_js_Object__sjs_js_Any(props); - var hook1_raw = $i_react.useState(() => { + + var __japgolly__hook1_raw = $i_react.useState(() => { $m_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$(); return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123); }); - var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); - var sum = ((props.a | 0) + (hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$().count$extension__sjs_js_Any__I(children) | 0; + + var __japgolly__hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook1_raw); + + var sum = ((props.a | 0) + (__japgolly__hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$().count$extension__sjs_js_Any__I(children) | 0; var $$x1 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); - var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((hook1$1 => () => { + var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((__japgolly__hook1$1 => () => { $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); - var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(hook1$1); + var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(__japgolly__hook1$1); return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$1$2 => { var x$1 = x$1$2 | 0; return 1 + x$1 | 0; })).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline); - })(hook1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(children))]; + })(__japgolly__hook1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(children))]; var this$17 = $$x1.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("button", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); return $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement.$f_Ljapgolly_scalajs_react_vdom_VdomElement__rawNode__sjs_js_$bar(this$17); -}, "MF3NO47k/7zFY+ODeoUMhnxB6Fg="); +}, "nfv15B7PjZ4t48VEMZ2SuYrvgqI="); var $d_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$ = new $j_java$002elang$002eObject.$TypeData().initClass({ Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$: 0 }, false, "japgolly.scalajs.react.test.emissions.HooksWithChildrenCtxFn$", { diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxFn-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxFn-out3.js index 95d206a52..b8ec9cc0f 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxFn-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxFn-out3.js @@ -33,29 +33,32 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$() { _s(); var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024package$0024PropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$package$PropsChildren$().fromRawProps__sjs_js_Object__O(props); - var hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); - var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); + + var __japgolly__hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); + + var __japgolly__hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook1_raw); + var p = props.a | 0; - var sum = (p + (hook1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + ($i_react.Children.count(children) | 0) | 0; + var sum = (p + (__japgolly__hook1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + ($i_react.Children.count(children) | 0) | 0; var this$15 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); var self = "button"; - var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((hook1$2 => () => { + var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((__japgolly__hook1$2 => () => { $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); - var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(hook1$2); + var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(__japgolly__hook1$2); var ev$1 = r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$1 => { var _$1$1 = _$1 | 0; return 1 + _$1$1 | 0; })); return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(ev$1 === null ? null : ev$1.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline); - })(hook1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(children))])); + })(__japgolly__hook1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(children))])); var this$16 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$15, self, xs); return this$16.rawElement__Ljapgolly_scalajs_react_facade_React$Element(); }; - _s(rawComponent, "+3ihSvpsaY0Wt3tAhbVZmTm3dGg="); + _s(rawComponent, "5jozhEwtxvMwDXdJFU53ltHZ+8U="); var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); var this$17 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxObj-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxObj-out2.js index e80de7538..81a0ed815 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxObj-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxObj-out2.js @@ -39,17 +39,20 @@ $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$.prototype.jap _s(); var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$().fromRawProps__sjs_js_Object__sjs_js_Any(props); - var hook1_raw = $i_react.useState(() => { + + var __japgolly__hook1_raw = $i_react.useState(() => { $m_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$(); return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123); }); - var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); + + var __japgolly__hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook1_raw); + var props$1 = props.a; - var sum = ((props$1 | 0) + (hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$().count$extension__sjs_js_Any__I(children) | 0; + var sum = ((props$1 | 0) + (__japgolly__hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$().count$extension__sjs_js_Any__I(children) | 0; $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); return new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; -}, "cFmG9aM+zFKRZ0BlWulKs0faOP4="); +}, "hmdkt3mZsFWuMhW4QTMYhjqDiVQ="); var $d_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$ = new $j_java$002elang$002eObject.$TypeData().initClass({ Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$: 0 }, false, "japgolly.scalajs.react.test.emissions.HooksWithChildrenCtxObj$", { diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxObj-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxObj-out3.js index 564ae211f..05590dc32 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxObj-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxObj-out3.js @@ -22,14 +22,17 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$() { _s(); var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024package$0024PropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$package$PropsChildren$().fromRawProps__sjs_js_Object__O(props); - var hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); - var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); + + var __japgolly__hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); + + var __japgolly__hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook1_raw); + var props$1 = props.a; - var sum = ((props$1 | 0) + (hook1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + ($i_react.Children.count(children) | 0) | 0; + var sum = ((props$1 | 0) + (__japgolly__hook1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + ($i_react.Children.count(children) | 0) | 0; return ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; }; - _s(rawComponent, "+3ihSvpsaY0Wt3tAhbVZmTm3dGg="); + _s(rawComponent, "5jozhEwtxvMwDXdJFU53ltHZ+8U="); var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); var this$7 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out2.js index 88981b56e..aba174383 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out2.js @@ -103,30 +103,38 @@ $c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$.prototype.japgolly$sca return $$x1.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("button", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); }; -$c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$.prototype.japgolly$scalajs$react$test$emissions$HooksWithJsFns$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box = function (props$1, hook1$1) { - return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction2__sjs_js_Function2__F2($p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__jsState1__sjs_js_Function2($m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$())).apply__O__O__O(props$1.a, hook1$1)); +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$.prototype.japgolly$scalajs$react$test$emissions$HooksWithJsFns$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box = function (props$1, __japgolly__hook1$1) { + return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction2__sjs_js_Function2__F2($p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__jsState1__sjs_js_Function2($m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$())).apply__O__O__O(props$1.a, __japgolly__hook1$1)); }; -$c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$.prototype.japgolly$scalajs$react$test$emissions$HooksWithJsFns$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box = function (hook3_ctx$1) { - return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction1__sjs_js_Function1__F1($m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$().Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__f_jsState2).apply__O__O(hook3_ctx$1)); +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$.prototype.japgolly$scalajs$react$test$emissions$HooksWithJsFns$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box = function (__japgolly__hook3_ctx$1) { + return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction1__sjs_js_Function1__F1($m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$().Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__f_jsState2).apply__O__O(__japgolly__hook3_ctx$1)); }; $c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$.prototype.japgolly$scalajs$react$test$emissions$HooksWithJsFns$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s(function (props) { _s(); - var hook1_raw = $i_react.useState(() => { + var __japgolly__hook1_raw = $i_react.useState(() => { $m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$(); return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(($m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$(), 123)); }); - var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); - var hook2_raw = $i_react.useState(((props$1, hook1$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$().japgolly$scalajs$react$test$emissions$HooksWithJsFns$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box(props$1, hook1$1))(props, hook1)); - var hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); + + var __japgolly__hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook1_raw); + + var __japgolly__hook2_raw = $i_react.useState(((props$1, __japgolly__hook1$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$().japgolly$scalajs$react$test$emissions$HooksWithJsFns$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box(props$1, __japgolly__hook1$1))(props, __japgolly__hook1)); + + var __japgolly__hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw); + var props$2 = props.a; - var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$2, hook1, hook2); - var hook3_raw = $i_react.useState((hook3_ctx$1 => () => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$().japgolly$scalajs$react$test$emissions$HooksWithJsFns$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box(hook3_ctx$1))(hook3_ctx)); - var hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); - return $j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction4__sjs_js_Function4__F4($p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__render__sjs_js_Function4($m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$())).apply__O__O__O__O__O(props.a, hook1, hook2, hook3).rawNode__sjs_js_$bar(); -}, "r+7/Q5EFFuapO5v2L90YcMjJcWo="); + + var __japgolly__hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$2, __japgolly__hook1, __japgolly__hook2); + + var __japgolly__hook3_raw = $i_react.useState((__japgolly__hook3_ctx$1 => () => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$().japgolly$scalajs$react$test$emissions$HooksWithJsFns$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box(__japgolly__hook3_ctx$1))(__japgolly__hook3_ctx)); + + var __japgolly__hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook3_raw); + + return $j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction4__sjs_js_Function4__F4($p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__render__sjs_js_Function4($m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$())).apply__O__O__O__O__O(props.a, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3).rawNode__sjs_js_$bar(); +}, "xmX5jTEGNoPOyfRzbmyGUWBpKps="); var $d_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$ = new $j_java$002elang$002eObject.$TypeData().initClass({ Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$: 0 }, false, "japgolly.scalajs.react.test.emissions.HooksWithJsFns$", { diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out3.js index 7dc0c1efa..4bc344947 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out3.js @@ -83,16 +83,24 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$() { return _s(props => { _s(); - var hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); - var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); - var hook2_raw = $i_react.useState(((this$2$2, props$2, hook1$2) => () => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction2__sjs_js_Function2__F2($p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__jsState1__sjs_js_Function2(this$2$2)).apply__O__O__O(props$2.a, hook1$2)))(this$2$1, props, hook1)); - var hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); + var __japgolly__hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); + + var __japgolly__hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook1_raw); + + var __japgolly__hook2_raw = $i_react.useState(((this$2$2, props$2, __japgolly__hook1$2) => () => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction2__sjs_js_Function2__F2($p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__jsState1__sjs_js_Function2(this$2$2)).apply__O__O__O(props$2.a, __japgolly__hook1$2)))(this$2$1, props, __japgolly__hook1)); + + var __japgolly__hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw); + var props$1 = props.a; - var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$1, hook1, hook2); - var hook3_raw = $i_react.useState(((this$3$1, hook3_ctx$2) => () => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction1__sjs_js_Function1__F1(this$3$1.Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__f_jsState2).apply__O__O(hook3_ctx$2)))(this$2$1, hook3_ctx)); - var hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); - return $j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction4__sjs_js_Function4__F4($p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__render__sjs_js_Function4(this$2$1)).apply__O__O__O__O__O(props.a, hook1, hook2, hook3).rawNode__O(); - }, "DGMqY1OYOh7G/wCDYn974GGuAaM="); + + var __japgolly__hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, __japgolly__hook1, __japgolly__hook2); + + var __japgolly__hook3_raw = $i_react.useState(((this$3$1, __japgolly__hook3_ctx$2) => () => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction1__sjs_js_Function1__F1(this$3$1.Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__f_jsState2).apply__O__O(__japgolly__hook3_ctx$2)))(this$2$1, __japgolly__hook3_ctx)); + + var __japgolly__hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook3_raw); + + return $j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction4__sjs_js_Function4__F4($p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__render__sjs_js_Function4(this$2$1)).apply__O__O__O__O__O(props.a, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3).rawNode__O(); + }, "cizXrFiX1+uWSjp+P70KP4g8wZM="); })(this); var $$x3 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out2.js index 5148831a1..b056fb50c 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out2.js @@ -88,37 +88,47 @@ function $h_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$() {} export { $h_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$ }; $h_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$.prototype; -$c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$.prototype.japgolly$scalajs$react$test$emissions$HooksWithScalaFns$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box = function (props$1, hook1$1) { - return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__state1__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__I($m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$(), props$1.a | 0, hook1$1)); +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$.prototype.japgolly$scalajs$react$test$emissions$HooksWithScalaFns$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box = function (props$1, __japgolly__hook1$1) { + return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__state1__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__I($m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$(), props$1.a | 0, __japgolly__hook1$1)); }; -$c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$.prototype.japgolly$scalajs$react$test$emissions$HooksWithScalaFns$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box = function (hook3_ctx$1) { - return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$().Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state2.apply__O__O(hook3_ctx$1)); +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$.prototype.japgolly$scalajs$react$test$emissions$HooksWithScalaFns$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box = function (__japgolly__hook3_ctx$1) { + return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$().Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state2.apply__O__O(__japgolly__hook3_ctx$1)); }; -$c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$.prototype.japgolly$scalajs$react$test$emissions$HooksWithScalaFns$$$anonfun$Component$5__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box = function (props$1, hook1$1, hook2$1, hook3$1) { - return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$().Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state3.apply__O__O__O__O__O(props$1.a, hook1$1, hook2$1, hook3$1)); +$c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$.prototype.japgolly$scalajs$react$test$emissions$HooksWithScalaFns$$$anonfun$Component$5__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box = function (props$1, __japgolly__hook1$1, __japgolly__hook2$1, __japgolly__hook3$1) { + return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$().Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state3.apply__O__O__O__O__O(props$1.a, __japgolly__hook1$1, __japgolly__hook2$1, __japgolly__hook3$1)); }; $c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$.prototype.japgolly$scalajs$react$test$emissions$HooksWithScalaFns$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s(function (props) { _s(); - var hook1_raw = $i_react.useState(() => { + var __japgolly__hook1_raw = $i_react.useState(() => { $m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$(); return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(($m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$(), 123)); }); - var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); - var hook2_raw = $i_react.useState(((props$1, hook1$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$().japgolly$scalajs$react$test$emissions$HooksWithScalaFns$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box(props$1, hook1$1))(props, hook1)); - var hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); + + var __japgolly__hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook1_raw); + + var __japgolly__hook2_raw = $i_react.useState(((props$1, __japgolly__hook1$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$().japgolly$scalajs$react$test$emissions$HooksWithScalaFns$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box(props$1, __japgolly__hook1$1))(props, __japgolly__hook1)); + + var __japgolly__hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw); + var props$2 = props.a; - var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$2, hook1, hook2); - var hook3_raw = $i_react.useState((hook3_ctx$1 => () => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$().japgolly$scalajs$react$test$emissions$HooksWithScalaFns$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box(hook3_ctx$1))(hook3_ctx)); - var hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); - var hook4_raw = $i_react.useState(((props$1$1, hook1$1$1, hook2$1, hook3$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$().japgolly$scalajs$react$test$emissions$HooksWithScalaFns$$$anonfun$Component$5__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box(props$1$1, hook1$1$1, hook2$1, hook3$1))(props, hook1, hook2, hook3)); - var hook4 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook4_raw); - var this$3 = $p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__render__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_vdom_TagOf($m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$(), props.a | 0, hook1, hook2, hook3, hook4); + + var __japgolly__hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$2, __japgolly__hook1, __japgolly__hook2); + + var __japgolly__hook3_raw = $i_react.useState((__japgolly__hook3_ctx$1 => () => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$().japgolly$scalajs$react$test$emissions$HooksWithScalaFns$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box(__japgolly__hook3_ctx$1))(__japgolly__hook3_ctx)); + + var __japgolly__hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook3_raw); + + var __japgolly__hook4_raw = $i_react.useState(((props$1$1, __japgolly__hook1$1$1, __japgolly__hook2$1, __japgolly__hook3$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$().japgolly$scalajs$react$test$emissions$HooksWithScalaFns$$$anonfun$Component$5__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box(props$1$1, __japgolly__hook1$1$1, __japgolly__hook2$1, __japgolly__hook3$1))(props, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3)); + + var __japgolly__hook4 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook4_raw); + + var this$3 = $p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__render__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_vdom_TagOf($m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$(), props.a | 0, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3, __japgolly__hook4); return $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement.$f_Ljapgolly_scalajs_react_vdom_VdomElement__rawNode__sjs_js_$bar(this$3); -}, "+6tsgMBzHFl0S/eNgc4PfF5XVtM="); +}, "CUCHactF8K3VolcNKBddVc/OdAo="); var $d_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$ = new $j_java$002elang$002eObject.$TypeData().initClass({ Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$: 0 }, false, "japgolly.scalajs.react.test.emissions.HooksWithScalaFns$", { diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out3.js index adf1f6e1b..94deabe93 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out3.js @@ -79,24 +79,34 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$() { return _s(props => { _s(); - var hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); - var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); - var hook2_raw = $i_react.useState(((this$2$2, props$2, hook1$2) => () => { + var __japgolly__hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); + + var __japgolly__hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook1_raw); + + var __japgolly__hook2_raw = $i_react.useState(((this$2$2, props$2, __japgolly__hook1$2) => () => { var $$x3 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); var p = props$2.a | 0; - return $$x3.apply__O__Ljapgolly_scalajs_react_internal_Box($p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__state1__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__I(this$2$2, p, hook1$2)); - })(this$3$1, props, hook1)); - var hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); + return $$x3.apply__O__Ljapgolly_scalajs_react_internal_Box($p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__state1__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__I(this$2$2, p, __japgolly__hook1$2)); + })(this$3$1, props, __japgolly__hook1)); + + var __japgolly__hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw); + var props$1 = props.a; - var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$1, hook1, hook2); - var hook3_raw = $i_react.useState(((this$3$2, hook3_ctx$2) => () => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(this$3$2.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state2.apply__O__O(hook3_ctx$2)))(this$3$1, hook3_ctx)); - var hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); - var hook4_raw = $i_react.useState(((this$4$1, props$3, hook1$3, hook2$2, hook3$2) => () => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(this$4$1.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state3.apply__O__O__O__O__O(props$3.a, hook1$3, hook2$2, hook3$2)))(this$3$1, props, hook1, hook2, hook3)); - var hook4 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook4_raw); + + var __japgolly__hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, __japgolly__hook1, __japgolly__hook2); + + var __japgolly__hook3_raw = $i_react.useState(((this$3$2, __japgolly__hook3_ctx$2) => () => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(this$3$2.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state2.apply__O__O(__japgolly__hook3_ctx$2)))(this$3$1, __japgolly__hook3_ctx)); + + var __japgolly__hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook3_raw); + + var __japgolly__hook4_raw = $i_react.useState(((this$4$1, props$3, __japgolly__hook1$3, __japgolly__hook2$2, __japgolly__hook3$2) => () => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(this$4$1.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state3.apply__O__O__O__O__O(props$3.a, __japgolly__hook1$3, __japgolly__hook2$2, __japgolly__hook3$2)))(this$3$1, props, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3)); + + var __japgolly__hook4 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook4_raw); + var p$1 = props.a | 0; - var this$6 = $p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__render__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_vdom_TagOf(this$3$1, p$1, hook1, hook2, hook3, hook4); + var this$6 = $p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__render__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_vdom_TagOf(this$3$1, p$1, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3, __japgolly__hook4); return this$6.rawElement__Ljapgolly_scalajs_react_facade_React$Element(); - }, "tiTMmuZfNiWpuBAqwIr3FRuMfVQ="); + }, "UNYENwiB2yOK0bLd6y904SSaSxQ="); })(this); var $$x4 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseCallback-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseCallback-out2.js index 0a209611d..74698121d 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseCallback-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseCallback-out2.js @@ -43,36 +43,52 @@ $h_Ljapgolly_scalajs_react_test_emissions_UseCallback$.prototype = $c_Ljapgolly_ $c_Ljapgolly_scalajs_react_test_emissions_UseCallback$.prototype.japgolly$scalajs$react$test$emissions$UseCallback$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s(function (props) { _s(); - var hook1_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$().callback__Ljapgolly_scalajs_react_util_Effect$Dispatch__Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); - var hook1_jscb = hook1_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_f$1.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline("aaaaaaaaaaaaaa", $j_java$002elang$002eCharacter$0024.$m_sci_Nil$()))); + var __japgolly__hook1_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$().callback__Ljapgolly_scalajs_react_util_Effect$Dispatch__Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); + + var __japgolly__hook1_jscb = __japgolly__hook1_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_f$1.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline("aaaaaaaaaaaaaa", $j_java$002elang$002eCharacter$0024.$m_sci_Nil$()))); + var $$x1 = $i_react; var a = []; - var hook1_raw = $$x1.useCallback(hook1_jscb, a); - var hook1 = hook1_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_g$1.apply__O__O(hook1_raw); + + var __japgolly__hook1_raw = $$x1.useCallback(__japgolly__hook1_jscb, a); + + var __japgolly__hook1 = __japgolly__hook1_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_g$1.apply__O__O(__japgolly__hook1_raw); + var props$1 = props.a; - var hook2_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$().callback__Ljapgolly_scalajs_react_util_Effect$Dispatch__Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); - var hook2_jscb = hook2_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_f$1.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline("bbbbbbbbbbbbbb" + props$1, $j_java$002elang$002eCharacter$0024.$m_sci_Nil$()))); + + var __japgolly__hook2_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$().callback__Ljapgolly_scalajs_react_util_Effect$Dispatch__Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); + + var __japgolly__hook2_jscb = __japgolly__hook2_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_f$1.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline("bbbbbbbbbbbbbb" + props$1, $j_java$002elang$002eCharacter$0024.$m_sci_Nil$()))); + var $$x2 = $i_react; var a$1 = []; - var hook2_raw = $$x2.useCallback(hook2_jscb, a$1); - var hook2 = hook2_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_g$1.apply__O__O(hook2_raw); - var hook3_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$().callback__Ljapgolly_scalajs_react_util_Effect$Dispatch__Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); - var hook3_jscb = hook3_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_f$1.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline("cccccccccccccc" + props.a, $j_java$002elang$002eCharacter$0024.$m_sci_Nil$()))); + + var __japgolly__hook2_raw = $$x2.useCallback(__japgolly__hook2_jscb, a$1); + + var __japgolly__hook2 = __japgolly__hook2_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_g$1.apply__O__O(__japgolly__hook2_raw); + + var __japgolly__hook3_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$().callback__Ljapgolly_scalajs_react_util_Effect$Dispatch__Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); + + var __japgolly__hook3_jscb = __japgolly__hook3_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_f$1.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline("cccccccccccccc" + props.a, $j_java$002elang$002eCharacter$0024.$m_sci_Nil$()))); + var $$x3 = $i_react; var a$2 = []; - var hook3_raw = $$x3.useCallback(hook3_jscb, a$2); - var hook3 = hook3_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_g$1.apply__O__O(hook3_raw); - var this$ = ($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), hook1.value__O()).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline; + + var __japgolly__hook3_raw = $$x3.useCallback(__japgolly__hook3_jscb, a$2); + + var __japgolly__hook3 = __japgolly__hook3_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_g$1.apply__O__O(__japgolly__hook3_raw); + + var this$ = ($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), __japgolly__hook1.value__O()).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline; $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$().run__Ljapgolly_scalajs_react_callback_Trampoline__O(this$); - var this$$1 = ($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), hook2.value__O()).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline; + var this$$1 = ($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), __japgolly__hook2.value__O()).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline; $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$().run__Ljapgolly_scalajs_react_callback_Trampoline__O(this$$1); - var this$$2 = ($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), hook3.value__O()).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline; + var this$$2 = ($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), __japgolly__hook3.value__O()).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline; $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$().run__Ljapgolly_scalajs_react_callback_Trampoline__O(this$$2); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); var v = props.a | 0; $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); return new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(v).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; -}, "PhZdn6j68F7BN76ND1U3bHNThVg="); +}, "iraUe4+KkOLn6ddQAIouaX7EXxE="); var $d_Ljapgolly_scalajs_react_test_emissions_UseCallback$ = new $j_java$002elang$002eObject.$TypeData().initClass({ Ljapgolly_scalajs_react_test_emissions_UseCallback$: 0 }, false, "japgolly.scalajs.react.test.emissions.UseCallback$", { diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseCallback-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseCallback-out3.js index 59ebf85f3..da850b89c 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseCallback-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseCallback-out3.js @@ -28,54 +28,76 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseCallback$() { var rawComponent = props => { _s(); - var hook1_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$().callback__Ljapgolly_scalajs_react_util_Effect$Dispatch__Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); - var $$x1 = hook1_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_f$1; + var __japgolly__hook1_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$().callback__Ljapgolly_scalajs_react_util_Effect$Dispatch__Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); + + var $$x1 = __japgolly__hook1_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_f$1; var optionalParams$proxy1 = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); var f$proxy3 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((optionalParams$proxy1$2 => () => { console.log("aaaaaaaaaaaaaa", ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy1$2)); })(optionalParams$proxy1)); - var hook1_jscb = $$x1.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy3)))); - var hook1_raw = $i_react.useCallback(hook1_jscb, []); - var hook1 = hook1_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_g$1.apply__O__O(hook1_raw); + + var __japgolly__hook1_jscb = $$x1.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy3)))); + + var __japgolly__hook1_raw = $i_react.useCallback(__japgolly__hook1_jscb, []); + + var __japgolly__hook1 = __japgolly__hook1_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_g$1.apply__O__O(__japgolly__hook1_raw); + var props$1 = props.a; - var hook2_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$().callback__Ljapgolly_scalajs_react_util_Effect$Dispatch__Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); - var $$x2 = hook2_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_f$1; + + var __japgolly__hook2_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$().callback__Ljapgolly_scalajs_react_util_Effect$Dispatch__Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); + + var $$x2 = __japgolly__hook2_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_f$1; var message$proxy1 = "bbbbbbbbbbbbbb" + props$1; var optionalParams$proxy2 = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); var f$proxy6 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((message$proxy1$2, optionalParams$proxy2$2) => () => { console.log(message$proxy1$2, ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy2$2)); })(message$proxy1, optionalParams$proxy2)); - var hook2_jscb = $$x2.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy6)))); - var hook2_raw = $i_react.useCallback(hook2_jscb, []); - var hook2 = hook2_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_g$1.apply__O__O(hook2_raw); - var hook3_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$().callback__Ljapgolly_scalajs_react_util_Effect$Dispatch__Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); - var $$x3 = hook3_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_f$1; + + var __japgolly__hook2_jscb = $$x2.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy6)))); + + var __japgolly__hook2_raw = $i_react.useCallback(__japgolly__hook2_jscb, []); + + var __japgolly__hook2 = __japgolly__hook2_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_g$1.apply__O__O(__japgolly__hook2_raw); + + var __japgolly__hook3_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$().callback__Ljapgolly_scalajs_react_util_Effect$Dispatch__Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); + + var $$x3 = __japgolly__hook3_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_f$1; var p = props.a | 0; var message$proxy2 = "cccccccccccccc" + p; var optionalParams$proxy3 = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); var f$proxy9 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((message$proxy2$2, optionalParams$proxy3$2) => () => { console.log(message$proxy2$2, ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy3$2)); })(message$proxy2, optionalParams$proxy3)); - var hook3_jscb = $$x3.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy9)))); - var hook3_raw = $i_react.useCallback(hook3_jscb, []); - var hook3 = hook3_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_g$1.apply__O__O(hook3_raw); + + var __japgolly__hook3_jscb = $$x3.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy9)))); + + var __japgolly__hook3_raw = $i_react.useCallback(__japgolly__hook3_jscb, []); + + var __japgolly__hook3 = __japgolly__hook3_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_g$1.apply__O__O(__japgolly__hook3_raw); + var p$2 = props.a | 0; $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); - var ev$1 = hook1.value__O(); + + var ev$1 = __japgolly__hook1.value__O(); + var CallbackTo_this = ev$1 === null ? null : ev$1.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline; $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$().run__Ljapgolly_scalajs_react_callback_Trampoline__O(CallbackTo_this); $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); - var ev$2 = hook2.value__O(); + + var ev$2 = __japgolly__hook2.value__O(); + var CallbackTo_this$2 = ev$2 === null ? null : ev$2.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline; $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$().run__Ljapgolly_scalajs_react_callback_Trampoline__O(CallbackTo_this$2); $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); - var ev$3 = hook3.value__O(); + + var ev$3 = __japgolly__hook3.value__O(); + var CallbackTo_this$3 = ev$3 === null ? null : ev$3.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline; $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$().run__Ljapgolly_scalajs_react_callback_Trampoline__O(CallbackTo_this$3); return ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(p$2)).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; }; - _s(rawComponent, "PhZdn6j68F7BN76ND1U3bHNThVg="); + _s(rawComponent, "iraUe4+KkOLn6ddQAIouaX7EXxE="); var $$x4 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); var this$21 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseMemo-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseMemo-out2.js index 97abeb8ea..01a5d2521 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseMemo-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseMemo-out2.js @@ -42,51 +42,58 @@ function $h_Ljapgolly_scalajs_react_test_emissions_UseMemo$() {} export { $h_Ljapgolly_scalajs_react_test_emissions_UseMemo$ }; $h_Ljapgolly_scalajs_react_test_emissions_UseMemo$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_UseMemo$.prototype; -$c_Ljapgolly_scalajs_react_test_emissions_UseMemo$.prototype.japgolly$scalajs$react$test$emissions$UseMemo$$$anonfun$Component$2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__I = function (hook1_deps_state$1) { - var arg1 = hook1_deps_state$1.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; +$c_Ljapgolly_scalajs_react_test_emissions_UseMemo$.prototype.japgolly$scalajs$react$test$emissions$UseMemo$$$anonfun$Component$2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__I = function (__japgolly__hook1_deps_state$1) { + var arg1 = __japgolly__hook1_deps_state$1.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; var x$1 = arg1; return x$1.length | 0; }; -$c_Ljapgolly_scalajs_react_test_emissions_UseMemo$.prototype.japgolly$scalajs$react$test$emissions$UseMemo$$$anonfun$Component$4__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_Reusable__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__I = function (props$1, hook1$1, hook2_deps_state$1) { - var arg1 = hook2_deps_state$1.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; +$c_Ljapgolly_scalajs_react_test_emissions_UseMemo$.prototype.japgolly$scalajs$react$test$emissions$UseMemo$$$anonfun$Component$4__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_Reusable__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__I = function (props$1, __japgolly__hook1$1, __japgolly__hook2_deps_state$1) { + var arg1 = __japgolly__hook2_deps_state$1.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; var x$2 = arg1; - return ((x$2.length | 0) + (props$1.a | 0) | 0) + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), hook1$1.value__O()) | 0) | 0; + return ((x$2.length | 0) + (props$1.a | 0) | 0) + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), __japgolly__hook1$1.value__O()) | 0) | 0; }; -$c_Ljapgolly_scalajs_react_test_emissions_UseMemo$.prototype.japgolly$scalajs$react$test$emissions$UseMemo$$$anonfun$Component$6__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__I = function (hook3_ctx$1, hook3_deps_state$1) { - var arg1 = hook3_deps_state$1.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; +$c_Ljapgolly_scalajs_react_test_emissions_UseMemo$.prototype.japgolly$scalajs$react$test$emissions$UseMemo$$$anonfun$Component$6__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__I = function (__japgolly__hook3_ctx$1, __japgolly__hook3_deps_state$1) { + var arg1 = __japgolly__hook3_deps_state$1.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; var x$3 = arg1; var $$x3 = x$3.length; - var $$x2 = hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + var $$x2 = __japgolly__hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); - var r = hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; + var r = __japgolly__hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; var $$x1 = r.value__O(); $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); - var r$1 = hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; + var r$1 = __japgolly__hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; return ((($$x3 | 0) + ($$x2 | 0) | 0) + ($$x1 | 0) | 0) + (r$1.value__O() | 0) | 0; }; $c_Ljapgolly_scalajs_react_test_emissions_UseMemo$.prototype.japgolly$scalajs$react$test$emissions$UseMemo$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s(function (props) { _s(); - var hook1_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_java$002elang$002eCharacter$0024.$m_s_None$())); - var hook1_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_state_raw); + var __japgolly__hook1_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_java$002elang$002eCharacter$0024.$m_s_None$())); + + var __japgolly__hook1_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook1_state_raw); + var $$x1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); var this$1 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); - var hook1_deps_state = $$x1.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState("blah", hook1_state, this$1.by_$eq$eq__F2()); + + var __japgolly__hook1_deps_state = $$x1.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState("blah", __japgolly__hook1_state, this$1.by_$eq$eq__F2()); + var $$x3 = $i_react; - var a = [hook1_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev]; - var $$x2 = $$x3.useMemo((hook1_deps_state$1 => () => $m_Ljapgolly_scalajs_react_test_emissions_UseMemo$().japgolly$scalajs$react$test$emissions$UseMemo$$$anonfun$Component$2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__I(hook1_deps_state$1))(hook1_deps_state), a); - var hook1_val = $$x2 | 0; + var a = [__japgolly__hook1_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev]; + var $$x2 = $$x3.useMemo((__japgolly__hook1_deps_state$1 => () => $m_Ljapgolly_scalajs_react_test_emissions_UseMemo$().japgolly$scalajs$react$test$emissions$UseMemo$$$anonfun$Component$2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__I(__japgolly__hook1_deps_state$1))(__japgolly__hook1_deps_state), a); + + var __japgolly__hook1_val = $$x2 | 0; + var this$9 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); - var a$1 = hook1_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev; + var a$1 = __japgolly__hook1_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev; var evidence$2 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); var this$8 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); var evidence$3 = this$8.by_$eq$eq__F2(); var e = new $j_japgolly$002escalajs$002ereact$002eReusability.$c_Ljapgolly_scalajs_react_Reusability(evidence$3); var r = e.Ljapgolly_scalajs_react_Reusability__f_test; - var hook1 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$p_Ljapgolly_scalajs_react_Reusable$__root__O__F1__Ljapgolly_scalajs_react_Reusable(this$9, a$1, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((evidence$1, reuse, a$2) => x$6$2 => { + + var __japgolly__hook1 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$p_Ljapgolly_scalajs_react_Reusable$__root__O__F1__Ljapgolly_scalajs_react_Reusable(this$9, a$1, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((evidence$1, reuse, a$2) => x$6$2 => { var x$6 = x$6$2; var x1 = x$6.Ljapgolly_scalajs_react_Reusable__f_japgolly$scalajs$react$Reusable$$root; @@ -100,26 +107,36 @@ $c_Ljapgolly_scalajs_react_test_emissions_UseMemo$.prototype.japgolly$scalajs$re ; return false; - })(evidence$2, r, a$1))).withValue__O__Ljapgolly_scalajs_react_Reusable(hook1_val); - var hook2_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_java$002elang$002eCharacter$0024.$m_s_None$())); - var hook2_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_state_raw); - var this$13 = (props.a | 0) + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), hook1.value__O()) | 0) | 0; - var hook2_deps = "" + this$13; + })(evidence$2, r, a$1))).withValue__O__Ljapgolly_scalajs_react_Reusable(__japgolly__hook1_val); + + var __japgolly__hook2_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_java$002elang$002eCharacter$0024.$m_s_None$())); + + var __japgolly__hook2_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_state_raw); + + var this$13 = (props.a | 0) + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), __japgolly__hook1.value__O()) | 0) | 0; + + var __japgolly__hook2_deps = "" + this$13; + var $$x4 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); var this$15 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); - var hook2_deps_state = $$x4.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(hook2_deps, hook2_state, this$15.by_$eq$eq__F2()); + + var __japgolly__hook2_deps_state = $$x4.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__hook2_deps, __japgolly__hook2_state, this$15.by_$eq$eq__F2()); + var $$x6 = $i_react; - var a$3 = [hook2_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev]; - var $$x5 = $$x6.useMemo(((props$1, hook1$1, hook2_deps_state$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_UseMemo$().japgolly$scalajs$react$test$emissions$UseMemo$$$anonfun$Component$4__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_Reusable__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__I(props$1, hook1$1, hook2_deps_state$1))(props, hook1, hook2_deps_state), a$3); - var hook2_val = $$x5 | 0; + var a$3 = [__japgolly__hook2_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev]; + var $$x5 = $$x6.useMemo(((props$1, __japgolly__hook1$1, __japgolly__hook2_deps_state$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_UseMemo$().japgolly$scalajs$react$test$emissions$UseMemo$$$anonfun$Component$4__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_Reusable__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__I(props$1, __japgolly__hook1$1, __japgolly__hook2_deps_state$1))(props, __japgolly__hook1, __japgolly__hook2_deps_state), a$3); + + var __japgolly__hook2_val = $$x5 | 0; + var this$23 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); - var a$4 = hook2_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev; + var a$4 = __japgolly__hook2_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev; var evidence$2$1 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); var this$22 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); var evidence$3$1 = this$22.by_$eq$eq__F2(); var e$1 = new $j_japgolly$002escalajs$002ereact$002eReusability.$c_Ljapgolly_scalajs_react_Reusability(evidence$3$1); var r$1 = e$1.Ljapgolly_scalajs_react_Reusability__f_test; - var hook2 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$p_Ljapgolly_scalajs_react_Reusable$__root__O__F1__Ljapgolly_scalajs_react_Reusable(this$23, a$4, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((evidence$1$1, reuse$1, a$5) => x$6$2$1 => { + + var __japgolly__hook2 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$p_Ljapgolly_scalajs_react_Reusable$__root__O__F1__Ljapgolly_scalajs_react_Reusable(this$23, a$4, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((evidence$1$1, reuse$1, a$5) => x$6$2$1 => { var x$6$1 = x$6$2$1; var x1$1 = x$6$1.Ljapgolly_scalajs_react_Reusable__f_japgolly$scalajs$react$Reusable$$root; @@ -133,34 +150,46 @@ $c_Ljapgolly_scalajs_react_test_emissions_UseMemo$.prototype.japgolly$scalajs$re ; return false; - })(evidence$2$1, r$1, a$4))).withValue__O__Ljapgolly_scalajs_react_Reusable(hook2_val); + })(evidence$2$1, r$1, a$4))).withValue__O__Ljapgolly_scalajs_react_Reusable(__japgolly__hook2_val); + var props$2 = props.a; - var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$2, hook1, hook2); - var hook3_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_java$002elang$002eCharacter$0024.$m_s_None$())); - var hook3_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_state_raw); - var $$x8 = hook3_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + + var __japgolly__hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$2, __japgolly__hook1, __japgolly__hook2); + + var __japgolly__hook3_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_java$002elang$002eCharacter$0024.$m_s_None$())); + + var __japgolly__hook3_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook3_state_raw); + + var $$x8 = __japgolly__hook3_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); - var r$2 = hook3_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; + var r$2 = __japgolly__hook3_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; var $$x7 = r$2.value__O(); $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); - var r$3 = hook3_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; + var r$3 = __japgolly__hook3_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; var this$29 = (($$x8 | 0) + ($$x7 | 0) | 0) + (r$3.value__O() | 0) | 0; - var hook3_deps = "" + this$29; + + var __japgolly__hook3_deps = "" + this$29; + var $$x9 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); var this$31 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); - var hook3_deps_state = $$x9.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(hook3_deps, hook3_state, this$31.by_$eq$eq__F2()); + + var __japgolly__hook3_deps_state = $$x9.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__hook3_deps, __japgolly__hook3_state, this$31.by_$eq$eq__F2()); + var $$x11 = $i_react; - var a$6 = [hook3_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev]; - var $$x10 = $$x11.useMemo(((hook3_ctx$1, hook3_deps_state$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_UseMemo$().japgolly$scalajs$react$test$emissions$UseMemo$$$anonfun$Component$6__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__I(hook3_ctx$1, hook3_deps_state$1))(hook3_ctx, hook3_deps_state), a$6); - var hook3_val = $$x10 | 0; + var a$6 = [__japgolly__hook3_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev]; + var $$x10 = $$x11.useMemo(((__japgolly__hook3_ctx$1, __japgolly__hook3_deps_state$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_UseMemo$().japgolly$scalajs$react$test$emissions$UseMemo$$$anonfun$Component$6__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__I(__japgolly__hook3_ctx$1, __japgolly__hook3_deps_state$1))(__japgolly__hook3_ctx, __japgolly__hook3_deps_state), a$6); + + var __japgolly__hook3_val = $$x10 | 0; + var this$39 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); - var a$7 = hook3_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev; + var a$7 = __japgolly__hook3_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev; var evidence$2$2 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); var this$38 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); var evidence$3$2 = this$38.by_$eq$eq__F2(); var e$2 = new $j_japgolly$002escalajs$002ereact$002eReusability.$c_Ljapgolly_scalajs_react_Reusability(evidence$3$2); var r$4 = e$2.Ljapgolly_scalajs_react_Reusability__f_test; - var hook3 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$p_Ljapgolly_scalajs_react_Reusable$__root__O__F1__Ljapgolly_scalajs_react_Reusable(this$39, a$7, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((evidence$1$2, reuse$2, a$8) => x$6$2$2 => { + + var __japgolly__hook3 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$p_Ljapgolly_scalajs_react_Reusable$__root__O__F1__Ljapgolly_scalajs_react_Reusable(this$39, a$7, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((evidence$1$2, reuse$2, a$8) => x$6$2$2 => { var x$6$3 = x$6$2$2; var x1$2 = x$6$3.Ljapgolly_scalajs_react_Reusable__f_japgolly$scalajs$react$Reusable$$root; @@ -174,12 +203,13 @@ $c_Ljapgolly_scalajs_react_test_emissions_UseMemo$.prototype.japgolly$scalajs$re ; return false; - })(evidence$2$2, r$4, a$7))).withValue__O__Ljapgolly_scalajs_react_Reusable(hook3_val); - var sum = (((props.a | 0) + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), hook1.value__O()) | 0) | 0) + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), hook2.value__O()) | 0) | 0) + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), hook3.value__O()) | 0) | 0; + })(evidence$2$2, r$4, a$7))).withValue__O__Ljapgolly_scalajs_react_Reusable(__japgolly__hook3_val); + + var sum = (((props.a | 0) + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), __japgolly__hook1.value__O()) | 0) | 0) + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), __japgolly__hook2.value__O()) | 0) | 0) + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), __japgolly__hook3.value__O()) | 0) | 0; $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); return new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; -}, "t8QZfg+hTPFXW2BFIxozHWoiMJ0="); +}, "g/Tz7NbhIH7V0FZisW0OUW6RhXo="); var $d_Ljapgolly_scalajs_react_test_emissions_UseMemo$ = new $j_java$002elang$002eObject.$TypeData().initClass({ Ljapgolly_scalajs_react_test_emissions_UseMemo$: 0 }, false, "japgolly.scalajs.react.test.emissions.UseMemo$", { diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseMemo-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseMemo-out3.js index 9965662e3..345d37101 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseMemo-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseMemo-out3.js @@ -27,23 +27,29 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseMemo$() { var rawComponent = props => { _s(); - var hook1_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_java$002elang$002eCharacter$0024.$m_s_None$())); - var hook1_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_state_raw); + var __japgolly__hook1_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_java$002elang$002eCharacter$0024.$m_s_None$())); + + var __japgolly__hook1_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook1_state_raw); + var $$x1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); var this$2 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); - var hook1_deps_state = $$x1.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState("blah", hook1_state, this$2.by_$eq$eq__F2()); - var hook1_val = $i_react.useMemo((hook1_deps_state$2 => () => { - var _$1$proxy1 = hook1_deps_state$2.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; + + var __japgolly__hook1_deps_state = $$x1.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState("blah", __japgolly__hook1_state, this$2.by_$eq$eq__F2()); + + var __japgolly__hook1_val = $i_react.useMemo((__japgolly__hook1_deps_state$2 => () => { + var _$1$proxy1 = __japgolly__hook1_deps_state$2.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; return _$1$proxy1.length | 0; - })(hook1_deps_state), [hook1_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev]) | 0; + })(__japgolly__hook1_deps_state), [__japgolly__hook1_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev]) | 0; + var this$8 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); - var a = hook1_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev; + var a = __japgolly__hook1_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev; var evidence$2 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); var this$7 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); var evidence$3 = this$7.by_$eq$eq__F2(); var e = new $j_japgolly$002escalajs$002ereact$002eReusability.$c_Ljapgolly_scalajs_react_Reusability(evidence$3); var r = e.Ljapgolly_scalajs_react_Reusability__f_test; - var hook1 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$p_Ljapgolly_scalajs_react_Reusable$__root__O__F1__Ljapgolly_scalajs_react_Reusable(this$8, a, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((a$2, reuse$2, evidence$1$2) => _$6 => { + + var __japgolly__hook1 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$p_Ljapgolly_scalajs_react_Reusable$__root__O__F1__Ljapgolly_scalajs_react_Reusable(this$8, a, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((a$2, reuse$2, evidence$1$2) => _$6 => { var _$6$1 = _$6; var x1 = _$6$1.Ljapgolly_scalajs_react_Reusable__f_root; @@ -58,28 +64,37 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseMemo$() { ; return false; - })(a, r, evidence$2))).withValue__O__Ljapgolly_scalajs_react_Reusable(hook1_val); - var hook2_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_java$002elang$002eCharacter$0024.$m_s_None$())); - var hook2_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_state_raw); + })(a, r, evidence$2))).withValue__O__Ljapgolly_scalajs_react_Reusable(__japgolly__hook1_val); + + var __japgolly__hook2_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_java$002elang$002eCharacter$0024.$m_s_None$())); + + var __japgolly__hook2_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_state_raw); + var p = props.a | 0; - var this$12 = p + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), hook1.value__O()) | 0) | 0; - var hook2_deps = "" + this$12; + var this$12 = p + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), __japgolly__hook1.value__O()) | 0) | 0; + + var __japgolly__hook2_deps = "" + this$12; + var $$x2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); var this$14 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); - var hook2_deps_state = $$x2.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(hook2_deps, hook2_state, this$14.by_$eq$eq__F2()); - var hook2_val = $i_react.useMemo(((props$2, hook1$2, hook2_deps_state$2) => () => { + + var __japgolly__hook2_deps_state = $$x2.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__hook2_deps, __japgolly__hook2_state, this$14.by_$eq$eq__F2()); + + var __japgolly__hook2_val = $i_react.useMemo(((props$2, __japgolly__hook1$2, __japgolly__hook2_deps_state$2) => () => { var p$1 = props$2.a | 0; - var _$2 = hook2_deps_state$2.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; - return ((_$2.length | 0) + p$1 | 0) + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), hook1$2.value__O()) | 0) | 0; - })(props, hook1, hook2_deps_state), [hook2_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev]) | 0; + var _$2 = __japgolly__hook2_deps_state$2.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; + return ((_$2.length | 0) + p$1 | 0) + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), __japgolly__hook1$2.value__O()) | 0) | 0; + })(props, __japgolly__hook1, __japgolly__hook2_deps_state), [__japgolly__hook2_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev]) | 0; + var this$20 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); - var a$1 = hook2_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev; + var a$1 = __japgolly__hook2_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev; var evidence$2$1 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); var this$19 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); var evidence$3$1 = this$19.by_$eq$eq__F2(); var e$1 = new $j_japgolly$002escalajs$002ereact$002eReusability.$c_Ljapgolly_scalajs_react_Reusability(evidence$3$1); var r$1 = e$1.Ljapgolly_scalajs_react_Reusability__f_test; - var hook2 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$p_Ljapgolly_scalajs_react_Reusable$__root__O__F1__Ljapgolly_scalajs_react_Reusable(this$20, a$1, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((a$2$1, reuse$2$1, evidence$1$2$1) => _$6$2 => { + + var __japgolly__hook2 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$p_Ljapgolly_scalajs_react_Reusable$__root__O__F1__Ljapgolly_scalajs_react_Reusable(this$20, a$1, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((a$2$1, reuse$2$1, evidence$1$2$1) => _$6$2 => { var _$6$3 = _$6$2; var x1$1 = _$6$3.Ljapgolly_scalajs_react_Reusable__f_root; @@ -94,41 +109,52 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseMemo$() { ; return false; - })(a$1, r$1, evidence$2$1))).withValue__O__Ljapgolly_scalajs_react_Reusable(hook2_val); + })(a$1, r$1, evidence$2$1))).withValue__O__Ljapgolly_scalajs_react_Reusable(__japgolly__hook2_val); + var props$1 = props.a; - var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$1, hook1, hook2); - var hook3_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_java$002elang$002eCharacter$0024.$m_s_None$())); - var hook3_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_state_raw); - var $$x4 = hook3_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + + var __japgolly__hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, __japgolly__hook1, __japgolly__hook2); + + var __japgolly__hook3_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_java$002elang$002eCharacter$0024.$m_s_None$())); + + var __japgolly__hook3_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook3_state_raw); + + var $$x4 = __japgolly__hook3_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); - var r$2 = hook3_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; + var r$2 = __japgolly__hook3_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; var $$x3 = r$2.value__O(); $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); - var r$3 = hook3_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; + var r$3 = __japgolly__hook3_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; var this$26 = (($$x4 | 0) + ($$x3 | 0) | 0) + (r$3.value__O() | 0) | 0; - var hook3_deps = "" + this$26; + + var __japgolly__hook3_deps = "" + this$26; + var $$x5 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); var this$28 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); - var hook3_deps_state = $$x5.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(hook3_deps, hook3_state, this$28.by_$eq$eq__F2()); - var hook3_val = $i_react.useMemo(((hook3_ctx$2, hook3_deps_state$2) => () => { - var _$3$proxy1 = hook3_deps_state$2.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; + + var __japgolly__hook3_deps_state = $$x5.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__hook3_deps, __japgolly__hook3_state, this$28.by_$eq$eq__F2()); + + var __japgolly__hook3_val = $i_react.useMemo(((__japgolly__hook3_ctx$2, __japgolly__hook3_deps_state$2) => () => { + var _$3$proxy1 = __japgolly__hook3_deps_state$2.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; var $$x8 = _$3$proxy1.length; - var $$x7 = hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + var $$x7 = __japgolly__hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); - var r$4 = hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; + var r$4 = __japgolly__hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; var $$x6 = r$4.value__O(); $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); - var r$5 = hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; + var r$5 = __japgolly__hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; return ((($$x8 | 0) + ($$x7 | 0) | 0) + ($$x6 | 0) | 0) + (r$5.value__O() | 0) | 0; - })(hook3_ctx, hook3_deps_state), [hook3_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev]) | 0; + })(__japgolly__hook3_ctx, __japgolly__hook3_deps_state), [__japgolly__hook3_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev]) | 0; + var this$35 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); - var a$3 = hook3_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev; + var a$3 = __japgolly__hook3_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev; var evidence$2$2 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); var this$34 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); var evidence$3$2 = this$34.by_$eq$eq__F2(); var e$2 = new $j_japgolly$002escalajs$002ereact$002eReusability.$c_Ljapgolly_scalajs_react_Reusability(evidence$3$2); var r$6 = e$2.Ljapgolly_scalajs_react_Reusability__f_test; - var hook3 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$p_Ljapgolly_scalajs_react_Reusable$__root__O__F1__Ljapgolly_scalajs_react_Reusable(this$35, a$3, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((a$2$2, reuse$2$2, evidence$1$2$2) => _$6$4 => { + + var __japgolly__hook3 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$p_Ljapgolly_scalajs_react_Reusable$__root__O__F1__Ljapgolly_scalajs_react_Reusable(this$35, a$3, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((a$2$2, reuse$2$2, evidence$1$2$2) => _$6$4 => { var _$6$5 = _$6$4; var x1$2 = _$6$5.Ljapgolly_scalajs_react_Reusable__f_root; @@ -143,13 +169,14 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseMemo$() { ; return false; - })(a$3, r$6, evidence$2$2))).withValue__O__Ljapgolly_scalajs_react_Reusable(hook3_val); + })(a$3, r$6, evidence$2$2))).withValue__O__Ljapgolly_scalajs_react_Reusable(__japgolly__hook3_val); + var p$2 = props.a | 0; - var sum = ((p$2 + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), hook1.value__O()) | 0) | 0) + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), hook2.value__O()) | 0) | 0) + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), hook3.value__O()) | 0) | 0; + var sum = ((p$2 + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), __japgolly__hook1.value__O()) | 0) | 0) + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), __japgolly__hook2.value__O()) | 0) | 0) + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), __japgolly__hook3.value__O()) | 0) | 0; return ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; }; - _s(rawComponent, "YQS7/w7UkmImlk8JQNlKaOp61ro="); + _s(rawComponent, "3AFql8ql6TNeaV3ZwsAY8AahdS4="); var $$x9 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); var this$43 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out2.js index 714fe06f4..d8c5202ef 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out2.js @@ -46,48 +46,56 @@ function $h_Ljapgolly_scalajs_react_test_emissions_UseState$() {} export { $h_Ljapgolly_scalajs_react_test_emissions_UseState$ }; $h_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype; -$c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype.japgolly$scalajs$react$test$emissions$UseState$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box = function (props$1, hook1$1) { - return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box((props$1.a | 0) + (hook1$1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0); +$c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype.japgolly$scalajs$react$test$emissions$UseState$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box = function (props$1, __japgolly__hook1$1) { + return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box((props$1.a | 0) + (__japgolly__hook1$1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0); }; -$c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype.japgolly$scalajs$react$test$emissions$UseState$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box = function (hook3_ctx$1) { +$c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype.japgolly$scalajs$react$test$emissions$UseState$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box = function (__japgolly__hook3_ctx$1) { var $$x3 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); - var $$x2 = hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; - var this$1 = hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; + var $$x2 = __japgolly__hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + var this$1 = __japgolly__hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; var $$x1 = this$1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]; - var this$2 = hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; + var this$2 = __japgolly__hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; return $$x3.apply__O__Ljapgolly_scalajs_react_internal_Box((($$x2 | 0) + ($$x1 | 0) | 0) + (this$2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0); }; $c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype.japgolly$scalajs$react$test$emissions$UseState$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s(function (props) { _s(); - var hook1_raw = $i_react.useState(() => { + var __japgolly__hook1_raw = $i_react.useState(() => { $m_Ljapgolly_scalajs_react_test_emissions_UseState$(); return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123); }); - var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); - var hook2_raw = $i_react.useState(((props$1, hook1$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_UseState$().japgolly$scalajs$react$test$emissions$UseState$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box(props$1, hook1$1))(props, hook1)); - var hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); + + var __japgolly__hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook1_raw); + + var __japgolly__hook2_raw = $i_react.useState(((props$1, __japgolly__hook1$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_UseState$().japgolly$scalajs$react$test$emissions$UseState$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box(props$1, __japgolly__hook1$1))(props, __japgolly__hook1)); + + var __japgolly__hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw); + var props$2 = props.a; - var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$2, hook1, hook2); - var hook3_raw = $i_react.useState((hook3_ctx$1 => () => $m_Ljapgolly_scalajs_react_test_emissions_UseState$().japgolly$scalajs$react$test$emissions$UseState$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box(hook3_ctx$1))(hook3_ctx)); - var hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); - var sum = ((hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) + (hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (hook3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0; + + var __japgolly__hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$2, __japgolly__hook1, __japgolly__hook2); + + var __japgolly__hook3_raw = $i_react.useState((__japgolly__hook3_ctx$1 => () => $m_Ljapgolly_scalajs_react_test_emissions_UseState$().japgolly$scalajs$react$test$emissions$UseState$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box(__japgolly__hook3_ctx$1))(__japgolly__hook3_ctx)); + + var __japgolly__hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook3_raw); + + var sum = ((__japgolly__hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) + (__japgolly__hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0; var $$x1 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); - var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((hook1$2 => () => { + var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((__japgolly__hook1$2 => () => { $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); - var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(hook1$2); + var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(__japgolly__hook1$2); return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$2$2 => { var x$2 = x$2$2 | 0; return 1 + x$2 | 0; })).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline); - })(hook1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]; + })(__japgolly__hook1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]; var this$15 = $$x1.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("button", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); return $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement.$f_Ljapgolly_scalajs_react_vdom_VdomElement__rawNode__sjs_js_$bar(this$15); -}, "qo8Jb8XvrnzpV9ZPNQN0hbh5dNs="); +}, "MvKah7VQR05BGCgwm78KUH5C90w="); var $d_Ljapgolly_scalajs_react_test_emissions_UseState$ = new $j_java$002elang$002eObject.$TypeData().initClass({ Ljapgolly_scalajs_react_test_emissions_UseState$: 0 }, false, "japgolly.scalajs.react.test.emissions.UseState$", { diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out3.js index 41510159c..ce3de0b48 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out3.js @@ -32,46 +32,54 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseState$() { var rawComponent = props => { _s(); - var hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); - var hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); - var hook2_raw = $i_react.useState(((props$2, hook1$2) => () => { + var __japgolly__hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); + + var __japgolly__hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook1_raw); + + var __japgolly__hook2_raw = $i_react.useState(((props$2, __japgolly__hook1$2) => () => { var $$x1 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); var p = props$2.a | 0; - return $$x1.apply__O__Ljapgolly_scalajs_react_internal_Box(p + (hook1$2.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0); - })(props, hook1)); - var hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); + return $$x1.apply__O__Ljapgolly_scalajs_react_internal_Box(p + (__japgolly__hook1$2.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0); + })(props, __japgolly__hook1)); + + var __japgolly__hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw); + var props$1 = props.a; - var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$1, hook1, hook2); - var hook3_raw = $i_react.useState((hook3_ctx$2 => () => { + + var __japgolly__hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, __japgolly__hook1, __japgolly__hook2); + + var __japgolly__hook3_raw = $i_react.useState((__japgolly__hook3_ctx$2 => () => { var $$x4 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); - var $$x3 = hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; - var this$4 = hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; + var $$x3 = __japgolly__hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + var this$4 = __japgolly__hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; var $$x2 = this$4.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; - var this$5 = hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; + var this$5 = __japgolly__hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; return $$x4.apply__O__Ljapgolly_scalajs_react_internal_Box((($$x3 | 0) + ($$x2 | 0) | 0) + (this$5.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0); - })(hook3_ctx)); - var hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); + })(__japgolly__hook3_ctx)); + + var __japgolly__hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook3_raw); + props.a | 0; - var sum = ((hook1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) + (hook2.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (hook3.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; + var sum = ((__japgolly__hook1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) + (__japgolly__hook2.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook3.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; var this$14 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); var self = "button"; - var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((hook1$3 => () => { + var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((__japgolly__hook1$3 => () => { $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); - var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(hook1$3); + var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(__japgolly__hook1$3); var ev$1 = r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$2 => { var _$2$1 = _$2 | 0; return 1 + _$2$1 | 0; })); return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(ev$1 === null ? null : ev$1.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline); - })(hook1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)])); + })(__japgolly__hook1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)])); var this$15 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$14, self, xs); return this$15.rawElement__Ljapgolly_scalajs_react_facade_React$Element(); }; - _s(rawComponent, "EjHC1fPm+wHx9Y3VO9JBQAyBf8s="); + _s(rawComponent, "OS8J16jWiM8/XN50US4YgU9Fqus="); var $$x5 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); var this$16 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out2.js index 7025c98f3..739fbf6a2 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out2.js @@ -17,8 +17,8 @@ import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 fr import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; -import * as $j_scala$002ereflect$002eManifestFactory$0024IntManifest$0024 from "./scala.reflect.ManifestFactory$IntManifest$.js"; function $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$() { this.Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$__f_Component = null; @@ -41,20 +41,20 @@ function $h_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$() {} export { $h_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$ }; $h_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$.prototype; -$c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$.prototype.japgolly$scalajs$react$test$emissions$UseStateWithReuse$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__Ljapgolly_scalajs_react_internal_Box = function (props$1, hook1$1) { +$c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$.prototype.japgolly$scalajs$react$test$emissions$UseStateWithReuse$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__Ljapgolly_scalajs_react_internal_Box = function (props$1, __japgolly__hook1$1) { var $$x2 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); var $$x1 = props$1.a; - var this$1 = hook1$1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var this$1 = __japgolly__hook1$1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; return $$x2.apply__O__Ljapgolly_scalajs_react_internal_Box(($$x1 | 0) + (this$1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0); }; -$c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$.prototype.japgolly$scalajs$react$test$emissions$UseStateWithReuse$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box = function (hook3_ctx$1) { +$c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$.prototype.japgolly$scalajs$react$test$emissions$UseStateWithReuse$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box = function (__japgolly__hook3_ctx$1) { var $$x3 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); - var $$x2 = hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; - var this$1 = hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; + var $$x2 = __japgolly__hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + var this$1 = __japgolly__hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; var this$2 = this$1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; var $$x1 = this$2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]; - var this$3 = hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; + var this$3 = __japgolly__hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; var this$4 = this$3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; return $$x3.apply__O__Ljapgolly_scalajs_react_internal_Box((($$x2 | 0) + ($$x1 | 0) | 0) + (this$4.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0); }; @@ -62,46 +62,57 @@ $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$.prototype.japgolly$ $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$.prototype.japgolly$scalajs$react$test$emissions$UseStateWithReuse$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s(function (props) { _s(); - var hook1_raw = $i_react.useState(() => { + var __japgolly__hook1_raw = $i_react.useState(() => { $m_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$(); return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123); }); + var this$2 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); var r = this$2.by_$eq$eq__F2(); - var ct = $j_scala$002ereflect$002eManifestFactory$0024IntManifest$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var ct = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); var rr = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r); - var this$6 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); + var this$6 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook1_raw); var us = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$6, r); - var hook1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us, rr, ct); - var hook2_raw = $i_react.useState(((props$1, hook1$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$().japgolly$scalajs$react$test$emissions$UseStateWithReuse$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__Ljapgolly_scalajs_react_internal_Box(props$1, hook1$1))(props, hook1)); + + var __japgolly__hook1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us, rr, ct); + + var __japgolly__hook2_raw = $i_react.useState(((props$1, __japgolly__hook1$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$().japgolly$scalajs$react$test$emissions$UseStateWithReuse$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__Ljapgolly_scalajs_react_internal_Box(props$1, __japgolly__hook1$1))(props, __japgolly__hook1)); + var this$7 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); var r$1 = this$7.by_$eq$eq__F2(); - var ct$1 = $j_scala$002ereflect$002eManifestFactory$0024IntManifest$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var ct$1 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); var rr$1 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r$1); - var this$11 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); + var this$11 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw); var us$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$11, r$1); - var hook2 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us$1, rr$1, ct$1); + + var __japgolly__hook2 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us$1, rr$1, ct$1); + var props$2 = props.a; - var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$2, hook1, hook2); - var hook3_raw = $i_react.useState((hook3_ctx$1 => () => $m_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$().japgolly$scalajs$react$test$emissions$UseStateWithReuse$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box(hook3_ctx$1))(hook3_ctx)); + + var __japgolly__hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$2, __japgolly__hook1, __japgolly__hook2); + + var __japgolly__hook3_raw = $i_react.useState((__japgolly__hook3_ctx$1 => () => $m_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$().japgolly$scalajs$react$test$emissions$UseStateWithReuse$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box(__japgolly__hook3_ctx$1))(__japgolly__hook3_ctx)); + var this$13 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); var r$2 = this$13.by_$eq$eq__F2(); - var ct$2 = $j_scala$002ereflect$002eManifestFactory$0024IntManifest$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var ct$2 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); var rr$2 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r$2); - var this$17 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); + var this$17 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook3_raw); var us$2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$17, r$2); - var hook3 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us$2, rr$2, ct$2); + + var __japgolly__hook3 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us$2, rr$2, ct$2); + props.a; - var this$19 = hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var this$19 = __japgolly__hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; var $$x2 = this$19.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]; - var this$20 = hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var this$20 = __japgolly__hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; var $$x1 = this$20.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]; - var this$21 = hook3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var this$21 = __japgolly__hook3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; var sum = (($$x2 | 0) + ($$x1 | 0) | 0) + (this$21.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0; $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); return new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; -}, "w7T9geXFnWi06+mB1Hyj8CKB8Kk="); +}, "RC9RF3UJUzTJNDHyeyY8zVbAzz0="); var $d_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$ = new $j_java$002elang$002eObject.$TypeData().initClass({ Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$: 0 }, false, "japgolly.scalajs.react.test.emissions.UseStateWithReuse$", { diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out3.js index ec1444e7d..4cd4e9c90 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out3.js @@ -14,8 +14,8 @@ import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./ import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; -import * as $j_scala$002ereflect$002eManifestFactory$0024IntManifest$0024 from "./scala.reflect.ManifestFactory$IntManifest$.js"; function $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$() { var _s = $RefreshSig$(); @@ -26,57 +26,68 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$() { var rawComponent = props => { _s(); - var hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); + var __japgolly__hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); + var this$3 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); var r = this$3.by_$eq$eq__F2(); - var ct = $j_scala$002ereflect$002eManifestFactory$0024IntManifest$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var ct = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); var rr = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r); - var this$8 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook1_raw); + var this$8 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook1_raw); var us = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$8, r); - var hook1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us, rr, ct); - var hook2_raw = $i_react.useState(((props$2, hook1$2) => () => { + + var __japgolly__hook1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us, rr, ct); + + var __japgolly__hook2_raw = $i_react.useState(((props$2, __japgolly__hook1$2) => () => { var $$x1 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); var p = props$2.a | 0; - var this$10 = hook1$2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var this$10 = __japgolly__hook1$2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; return $$x1.apply__O__Ljapgolly_scalajs_react_internal_Box(p + (this$10.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0); - })(props, hook1)); + })(props, __japgolly__hook1)); + var this$11 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); var r$1 = this$11.by_$eq$eq__F2(); - var ct$1 = $j_scala$002ereflect$002eManifestFactory$0024IntManifest$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var ct$1 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); var rr$1 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r$1); - var this$16 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook2_raw); + var this$16 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw); var us$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$16, r$1); - var hook2 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us$1, rr$1, ct$1); + + var __japgolly__hook2 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us$1, rr$1, ct$1); + var props$1 = props.a; - var hook3_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(props$1, hook1, hook2); - var hook3_raw = $i_react.useState((hook3_ctx$2 => () => { + + var __japgolly__hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, __japgolly__hook1, __japgolly__hook2); + + var __japgolly__hook3_raw = $i_react.useState((__japgolly__hook3_ctx$2 => () => { var $$x4 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); - var $$x3 = hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; - var this$19 = hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; + var $$x3 = __japgolly__hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + var this$19 = __japgolly__hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; var this$20 = this$19.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; var $$x2 = this$20.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; - var this$21 = hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; + var this$21 = __japgolly__hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; var this$22 = this$21.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; return $$x4.apply__O__Ljapgolly_scalajs_react_internal_Box((($$x3 | 0) + ($$x2 | 0) | 0) + (this$22.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0); - })(hook3_ctx)); + })(__japgolly__hook3_ctx)); + var this$23 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); var r$2 = this$23.by_$eq$eq__F2(); - var ct$2 = $j_scala$002ereflect$002eManifestFactory$0024IntManifest$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var ct$2 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); var rr$2 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r$2); - var this$28 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(hook3_raw); + var this$28 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook3_raw); var us$2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$28, r$2); - var hook3 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us$2, rr$2, ct$2); + + var __japgolly__hook3 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us$2, rr$2, ct$2); + props.a; - var this$31 = hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var this$31 = __japgolly__hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; var $$x6 = this$31.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; - var this$32 = hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var this$32 = __japgolly__hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; var $$x5 = this$32.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; - var this$33 = hook3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var this$33 = __japgolly__hook3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; var sum = (($$x6 | 0) + ($$x5 | 0) | 0) + (this$33.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; return ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; }; - _s(rawComponent, "+059i36eGzSqNFL1PwYIRLAIpQ4="); + _s(rawComponent, "DstOFN78pFHm3XD0J31WCO1Go4A="); var $$x7 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); var this$36 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); From e86848202ae261aa667e358d6e87449873a7cf16 Mon Sep 17 00:00:00 2001 From: David Barri Date: Wed, 22 Jun 2022 16:46:19 +1000 Subject: [PATCH 62/72] Consolidate some RR tests; test time is starting to get annoying --- .../react/test/emissions/CustomHooks.scala | 13 +- .../react/test/emissions/CustomHooksBy.scala | 20 --- .../react/test/emissions/HooksTrivial.scala | 9 +- .../scalajs/react/test/emissions/Main.scala | 2 - .../react/test/emissions/UseState.scala | 19 --- .../test/resources/rr-sjr/CustomHooks-out2.js | 58 +++++++- .../test/resources/rr-sjr/CustomHooks-out3.js | 75 +++++++++-- .../resources/rr-sjr/CustomHooksBy-out2.js | 121 ----------------- .../resources/rr-sjr/CustomHooksBy-out3.js | 127 ------------------ .../resources/rr-sjr/HooksTrivial-out2.js | 40 +++++- .../resources/rr-sjr/HooksTrivial-out3.js | 41 +++++- .../test/emissions/ReactRefreshTest.scala | 2 - 12 files changed, 207 insertions(+), 320 deletions(-) delete mode 100644 library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/CustomHooksBy.scala delete mode 100644 library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseState.scala delete mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out2.js delete mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out3.js diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/CustomHooks.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/CustomHooks.scala index e8c3578a8..3d3f7971a 100644 --- a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/CustomHooks.scala +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/CustomHooks.scala @@ -8,13 +8,22 @@ object CustomHooks { val customHook1 = CustomHook[Int].useStateBy(_ + 1).buildReturning(_.hook1) val customHook2 = CustomHook[Unit].useEffect(Callback.log("hello")).build val customHook3 = CustomHook[Unit].useState(123).buildReturning(_.hook1) + val customHook4 = CustomHook[Int].useStateBy(_ + 1).buildReturning(_.hook1) + val customHook5 = CustomHook[Int].useStateBy(_ * 2).buildReturning(_.hook1) + val customHook6 = CustomHook[Int].useStateBy(_ * 3).buildReturning(_.hook1) val Component = ScalaFnComponent.withHooks[Int] + .custom(customHook1) .custom(customHook2) .custom(customHook3) - .renderRR { (p, s1, s2) => - val sum = p + s1.value + s2.value + + .customBy((p, _, _) => customHook4(p - 1)) + .customBy((_, _, _, a) => customHook5(a.value)) + .customBy($ => customHook6($.hook4.value)) + + .renderRR { (p, s1, s2, s3, s4, s5) => + val sum = p + s1.value + s2.value + s3.value + s4.value + s5.value <.div("Sum = ", sum) } } diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/CustomHooksBy.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/CustomHooksBy.scala deleted file mode 100644 index 13d520139..000000000 --- a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/CustomHooksBy.scala +++ /dev/null @@ -1,20 +0,0 @@ -package japgolly.scalajs.react.test.emissions - -import japgolly.scalajs.react._ -import japgolly.scalajs.react.vdom.html_<^._ - -object CustomHooksBy { - - val customHook1 = CustomHook[Int].useStateBy(_ + 1).buildReturning(_.hook1) - val customHook2 = CustomHook[Int].useStateBy(_ * 2).buildReturning(_.hook1) - val customHook3 = CustomHook[Int].useStateBy(_ * 3).buildReturning(_.hook1) - - val Component = ScalaFnComponent.withHooks[Int] - .customBy(p => customHook1(p - 1)) - .customBy((_, s1) => customHook2(s1.value)) - .customBy($ => customHook3($.hook2.value)) - .renderRR { (p, s1, s2, s3) => - val sum = p + s1.value + s2.value + s3.value - <.div("Sum = ", sum) - } -} diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksTrivial.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksTrivial.scala index 34017ee45..7d42ace89 100644 --- a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksTrivial.scala +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksTrivial.scala @@ -2,7 +2,6 @@ package japgolly.scalajs.react.test.emissions import japgolly.scalajs.react._ import japgolly.scalajs.react.vdom.html_<^._ -import org.scalajs.dom.console object HooksTrivial { @@ -23,8 +22,12 @@ object HooksTrivial { .useReducerBy((p, _, _, _, _) => add(p), _ + _ + _ + _ + _.value) .useReducerBy($ => add($.hook4.value), $ => $.props + $.hook4.value + $.hook5.value) - .renderRR { (_, a, b, c, d, e, f) => - val sum = a + b + c + d.value + e.value + f.value + .useState(123) + .useStateBy((p, a, _, _, _, _, f, _) => p + a + f.value) + .useStateBy($ => $.props + $.hook1 + $.hook6.value) + + .renderRR { (_, a, b, c, d, e, f, g, h, i) => + val sum = a + b + c + d.value + e.value + f.value + g.value + h.value + i.value sum } } diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala index e5b6e4582..7f353cc79 100644 --- a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala @@ -15,7 +15,6 @@ object Main { private val Component = ScalaFnComponent[Unit] { _ => <.div( CustomHooks .Component(0), - CustomHooksBy .Component(0), HooksPrimative .Component(), HooksTrivial .Component(0), HooksWithChildrenCtxFn .Component(0)(<.div), @@ -26,7 +25,6 @@ object Main { JustPropsViaHookApi .Component(0), UseCallback .Component(0), UseMemo .Component(0), - UseState .Component(0), UseStateWithReuse .Component(0), ) } diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseState.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseState.scala deleted file mode 100644 index a1d53a761..000000000 --- a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseState.scala +++ /dev/null @@ -1,19 +0,0 @@ -package japgolly.scalajs.react.test.emissions - -import japgolly.scalajs.react._ -import japgolly.scalajs.react.vdom.html_<^._ - -object UseState { - - val Component = ScalaFnComponent.withHooks[Int] - .useState(123) - .useStateBy((p, s1) => p + s1.value) - .useStateBy($ => $.props + $.hook1.value + $.hook2.value) - .renderRR { (_, s1, s2, s3) => - val sum = s1.value + s2.value + s3.value - <.button( - "Sum = ", sum, - ^.onClick --> s1.modState(_ + 1), - ) - } -} diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out2.js index e213bedcc..146382b9f 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out2.js @@ -5,6 +5,7 @@ import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from " import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary from "./japgolly.scalajs.react.hooks.Api$Primary.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024 from "./japgolly.scalajs.react.hooks.CustomHook$.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Arg$0024 from "./japgolly.scalajs.react.hooks.CustomHook$Arg$.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First from "./japgolly.scalajs.react.hooks.CustomHook$Builder$First.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024Subsequent from "./japgolly.scalajs.react.hooks.CustomHook$Builder$Subsequent.js"; @@ -30,6 +31,9 @@ function $c_Ljapgolly_scalajs_react_test_emissions_CustomHooks$() { this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook1 = null; this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook2 = null; this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook3 = null; + this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook4 = null; + this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook5 = null; + this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook6 = null; this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_Component = null; $n_Ljapgolly_scalajs_react_test_emissions_CustomHooks$ = this; var this$3 = $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_CustomHook.apply__Ljapgolly_scalajs_react_hooks_CustomHook$Builder$First(); @@ -54,13 +58,43 @@ function $c_Ljapgolly_scalajs_react_test_emissions_CustomHooks$() { var x$3 = x$3$2; return x$3.Ljapgolly_scalajs_react_hooks_HookCtx$I1__f_hook1; })); + var this$10 = $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_CustomHook.apply__Ljapgolly_scalajs_react_hooks_CustomHook$Builder$First(); + var initialState$2 = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$4$2 => { + var x$4 = x$4$2 | 0; + return 1 + x$4 | 0; + }); + var step$3 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First.$c_Ljapgolly_scalajs_react_hooks_CustomHook$Builder$FirstStep(); + this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook4 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useStateBy__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$10, initialState$2, step$3).buildReturning__F1__F1(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$5$2 => { + var x$5 = x$5$2; + return x$5.Ljapgolly_scalajs_react_hooks_HookCtx$I1__f_hook1; + })); + var this$12 = $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_CustomHook.apply__Ljapgolly_scalajs_react_hooks_CustomHook$Builder$First(); + var initialState$3 = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$6$2 => { + var x$6 = x$6$2 | 0; + return x$6 << 1; + }); + var step$4 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First.$c_Ljapgolly_scalajs_react_hooks_CustomHook$Builder$FirstStep(); + this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook5 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useStateBy__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$12, initialState$3, step$4).buildReturning__F1__F1(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$7$2 => { + var x$7 = x$7$2; + return x$7.Ljapgolly_scalajs_react_hooks_HookCtx$I1__f_hook1; + })); + var this$14 = $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_CustomHook.apply__Ljapgolly_scalajs_react_hooks_CustomHook$Builder$First(); + var initialState$4 = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$8$2 => { + var x$8 = x$8$2 | 0; + return Math.imul(3, x$8); + }); + var step$5 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First.$c_Ljapgolly_scalajs_react_hooks_CustomHook$Builder$FirstStep(); + this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook6 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useStateBy__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$14, initialState$4, step$5).buildReturning__F1__F1(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$9$2 => { + var x$9 = x$9$2; + return x$9.Ljapgolly_scalajs_react_hooks_HookCtx$I1__f_hook1; + })); var rawComponent = arg1$2 => $m_Ljapgolly_scalajs_react_test_emissions_CustomHooks$().japgolly$scalajs$react$test$emissions$CustomHooks$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2); var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); - var this$9 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var this$15 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$(), null)); - this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$9.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); + this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$15.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); } export { $c_Ljapgolly_scalajs_react_test_emissions_CustomHooks$ }; @@ -84,13 +118,27 @@ $c_Ljapgolly_scalajs_react_test_emissions_CustomHooks$.prototype.japgolly$scalaj var __japgolly__hook3 = $m_Ljapgolly_scalajs_react_test_emissions_CustomHooks$().Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook3.apply__O__O(void 0); - var sum = ((props.a | 0) + (__japgolly__hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0; + var __japgolly__hook4_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1($m_Ljapgolly_scalajs_react_test_emissions_CustomHooks$().Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook4, -1 + (props.a | 0) | 0); + + var __japgolly__hook4 = __japgolly__hook4_raw.apply__O__O(void 0); + + var __japgolly__hook5_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1($m_Ljapgolly_scalajs_react_test_emissions_CustomHooks$().Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook5, __japgolly__hook4.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]); + + var __japgolly__hook5 = __japgolly__hook5_raw.apply__O__O(void 0); + + props.a; + + var __japgolly__hook6_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1($m_Ljapgolly_scalajs_react_test_emissions_CustomHooks$().Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook6, __japgolly__hook5.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]); + + var __japgolly__hook6 = __japgolly__hook6_raw.apply__O__O(void 0); + + var sum = (((((props.a | 0) + (__japgolly__hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook4.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook5.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook6.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0; var $$x1 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum))]; - var this$11 = $$x1.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("div", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); - return $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement.$f_Ljapgolly_scalajs_react_vdom_VdomElement__rawNode__sjs_js_$bar(this$11); + var this$12 = $$x1.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("div", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); + return $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement.$f_Ljapgolly_scalajs_react_vdom_VdomElement__rawNode__sjs_js_$bar(this$12); }; var $d_Ljapgolly_scalajs_react_test_emissions_CustomHooks$ = new $j_java$002elang$002eObject.$TypeData().initClass({ diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out3.js index b164d5b9d..020699871 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out3.js @@ -7,6 +7,7 @@ import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024De import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary from "./japgolly.scalajs.react.hooks.Api$Primary.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024 from "./japgolly.scalajs.react.hooks.CustomHook$.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Arg$0024 from "./japgolly.scalajs.react.hooks.CustomHook$Arg$.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First from "./japgolly.scalajs.react.hooks.CustomHook$Builder$First.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024Subsequent from "./japgolly.scalajs.react.hooks.CustomHook$Builder$Subsequent.js"; @@ -32,6 +33,9 @@ function $c_Ljapgolly_scalajs_react_test_emissions_CustomHooks$() { this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook1 = null; this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook2 = null; this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook3 = null; + this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook4 = null; + this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook5 = null; + this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook6 = null; this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_Component = null; $n_Ljapgolly_scalajs_react_test_emissions_CustomHooks$ = this; var this$3 = $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_CustomHook.apply__Ljapgolly_scalajs_react_hooks_CustomHook$Builder$First(); @@ -61,31 +65,82 @@ function $c_Ljapgolly_scalajs_react_test_emissions_CustomHooks$() { var _$3$1 = _$3; return _$3$1.Ljapgolly_scalajs_react_hooks_HookCtx$I1__f_hook1; })); + var this$12 = $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_CustomHook.apply__Ljapgolly_scalajs_react_hooks_CustomHook$Builder$First(); + var initialState$2 = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$4 => { + var _$4$1 = _$4 | 0; - var rawComponent = (this$6$1 => props => { + return 1 + _$4$1 | 0; + }); + var step$3 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First.$c_Ljapgolly_scalajs_react_hooks_CustomHook$Builder$FirstStep(); + this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook4 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useStateBy__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$12, initialState$2, step$3).buildReturning__F1__F1(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$5 => { + var _$5$1 = _$5; + return _$5$1.Ljapgolly_scalajs_react_hooks_HookCtx$I1__f_hook1; + })); + var this$14 = $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_CustomHook.apply__Ljapgolly_scalajs_react_hooks_CustomHook$Builder$First(); + var initialState$3 = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$6 => { + var _$6$1 = _$6 | 0; + + return _$6$1 << 1; + }); + var step$4 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First.$c_Ljapgolly_scalajs_react_hooks_CustomHook$Builder$FirstStep(); + this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook5 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useStateBy__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$14, initialState$3, step$4).buildReturning__F1__F1(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$7 => { + var _$7$1 = _$7; + return _$7$1.Ljapgolly_scalajs_react_hooks_HookCtx$I1__f_hook1; + })); + var this$16 = $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_CustomHook.apply__Ljapgolly_scalajs_react_hooks_CustomHook$Builder$First(); + var initialState$4 = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$8 => { + var _$8$1 = _$8 | 0; + + return Math.imul(3, _$8$1); + }); + var step$5 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First.$c_Ljapgolly_scalajs_react_hooks_CustomHook$Builder$FirstStep(); + this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook6 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useStateBy__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$16, initialState$4, step$5).buildReturning__F1__F1(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$9 => { + var _$9$1 = _$9; + return _$9$1.Ljapgolly_scalajs_react_hooks_HookCtx$I1__f_hook1; + })); + + var rawComponent = (this$12$1 => props => { var __japgolly__hook1_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Arg$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$Arg$().exactId__F1().apply__O__O(props.a) | 0; - var __japgolly__hook1 = this$6$1.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook1.apply__O__O(__japgolly__hook1_arg); + var __japgolly__hook1 = this$12$1.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook1.apply__O__O(__japgolly__hook1_arg); - this$6$1.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook2.apply__O__O(void 0); + this$12$1.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook2.apply__O__O(void 0); - var __japgolly__hook3 = this$6$1.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook3.apply__O__O(void 0); + var __japgolly__hook3 = this$12$1.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook3.apply__O__O(void 0); var p = props.a | 0; - var sum = (p + (__japgolly__hook1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook3.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; - var this$17 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + + var __japgolly__hook4_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1(this$12$1.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook4, -1 + p | 0); + + var __japgolly__hook4 = __japgolly__hook4_raw.apply__O__O(void 0); + + props.a | 0; + + var __japgolly__hook5_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1(this$12$1.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook5, __japgolly__hook4.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); + + var __japgolly__hook5 = __japgolly__hook5_raw.apply__O__O(void 0); + + props.a; + + var __japgolly__hook6_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1(this$12$1.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook6, __japgolly__hook5.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); + + var __japgolly__hook6 = __japgolly__hook6_raw.apply__O__O(void 0); + + var p$2 = props.a | 0; + var sum = ((((p$2 + (__japgolly__hook1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook3.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook4.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook5.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook6.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; + var this$24 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); var self = "div"; var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum))])); - var this$18 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$17, self, xs); - return this$18.rawElement__Ljapgolly_scalajs_react_facade_React$Element(); + var this$25 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$24, self, xs); + return this$25.rawElement__Ljapgolly_scalajs_react_facade_React$Element(); })(this); var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); - var this$19 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var this$26 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); - this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$19.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); + this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$26.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); } export { $c_Ljapgolly_scalajs_react_test_emissions_CustomHooks$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out2.js deleted file mode 100644 index efba16d2d..000000000 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out2.js +++ /dev/null @@ -1,121 +0,0 @@ -'use strict'; - -import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary from "./japgolly.scalajs.react.hooks.Api$Primary.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024 from "./japgolly.scalajs.react.hooks.CustomHook$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First from "./japgolly.scalajs.react.hooks.CustomHook$Builder$First.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024Subsequent from "./japgolly.scalajs.react.hooks.CustomHook$Builder$Subsequent.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024I1 from "./japgolly.scalajs.react.hooks.HookCtx$I1.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF from "./japgolly.scalajs.react.hooks.Hooks$UseStateF.js"; -import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 from "./japgolly.scalajs.react.internal.Singleton$.js"; -import * as $j_japgolly$002escalajs$002ereact$002epackage$0024 from "./japgolly.scalajs.react.package$.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement from "./japgolly.scalajs.react.vdom.VdomElement.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; -import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; -import * as $j_scala$002eFunction1 from "./scala.Function1.js"; -import * as $j_scala$002escalajs$002eruntime$002eWrappedVarArgs from "./scala.scalajs.runtime.WrappedVarArgs.js"; - -function $c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$() { - this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook1 = null; - this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook2 = null; - this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook3 = null; - this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_Component = null; - $n_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$ = this; - var this$3 = $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_CustomHook.apply__Ljapgolly_scalajs_react_hooks_CustomHook$Builder$First(); - var initialState = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$1$2 => { - var x$1 = x$1$2 | 0; - return 1 + x$1 | 0; - }); - var step = new $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First.$c_Ljapgolly_scalajs_react_hooks_CustomHook$Builder$FirstStep(); - this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useStateBy__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$3, initialState, step).buildReturning__F1__F1(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$2$2 => { - var x$2 = x$2$2; - return x$2.Ljapgolly_scalajs_react_hooks_HookCtx$I1__f_hook1; - })); - var this$5 = $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_CustomHook.apply__Ljapgolly_scalajs_react_hooks_CustomHook$Builder$First(); - var initialState$1 = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$3$2 => { - var x$3 = x$3$2 | 0; - return x$3 << 1; - }); - var step$1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First.$c_Ljapgolly_scalajs_react_hooks_CustomHook$Builder$FirstStep(); - this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useStateBy__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$5, initialState$1, step$1).buildReturning__F1__F1(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$4$2 => { - var x$4 = x$4$2; - return x$4.Ljapgolly_scalajs_react_hooks_HookCtx$I1__f_hook1; - })); - var this$7 = $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_CustomHook.apply__Ljapgolly_scalajs_react_hooks_CustomHook$Builder$First(); - var initialState$2 = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$5$2 => { - var x$5 = x$5$2 | 0; - return Math.imul(3, x$5); - }); - var step$2 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First.$c_Ljapgolly_scalajs_react_hooks_CustomHook$Builder$FirstStep(); - this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useStateBy__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$7, initialState$2, step$2).buildReturning__F1__F1(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$6$2 => { - var x$6 = x$6$2; - return x$6.Ljapgolly_scalajs_react_hooks_HookCtx$I1__f_hook1; - })); - - var rawComponent = arg1$2 => $m_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$().japgolly$scalajs$react$test$emissions$CustomHooksBy$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2); - - var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); - var this$8 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); - var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$(), null)); - this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$8.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); -} - -export { $c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$ }; -$c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$.prototype = new $j_java$002elang$002eObject.$h_O(); -$c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$; - -function $h_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$() {} - -export { $h_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$ }; -$h_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$.prototype; - -$c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$.prototype.japgolly$scalajs$react$test$emissions$CustomHooksBy$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = function (props) { - var __japgolly__hook1_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1($m_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$().Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook1, -1 + (props.a | 0) | 0); - - var __japgolly__hook1 = __japgolly__hook1_raw.apply__O__O(void 0); - - var __japgolly__hook2_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1($m_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$().Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook2, __japgolly__hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]); - - var __japgolly__hook2 = __japgolly__hook2_raw.apply__O__O(void 0); - - props.a; - - var __japgolly__hook3_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1($m_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$().Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook3, __japgolly__hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]); - - var __japgolly__hook3 = __japgolly__hook3_raw.apply__O__O(void 0); - - var sum = (((props.a | 0) + (__japgolly__hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0; - var $$x1 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); - $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); - $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); - var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum))]; - var this$11 = $$x1.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("div", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); - return $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement.$f_Ljapgolly_scalajs_react_vdom_VdomElement__rawNode__sjs_js_$bar(this$11); -}; - -var $d_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$ = new $j_java$002elang$002eObject.$TypeData().initClass({ - Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$: 0 -}, false, "japgolly.scalajs.react.test.emissions.CustomHooksBy$", { - Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$: 1, - O: 1 -}); -export { $d_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$ }; -$c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$; -var $n_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$; - -function $m_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$() { - if (!$n_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$) { - $n_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$ = new $c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$(); - } - - ; - return $n_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$; -} - -export { $m_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out3.js deleted file mode 100644 index e69ac1101..000000000 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooksBy-out3.js +++ /dev/null @@ -1,127 +0,0 @@ -'use strict'; - -import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary from "./japgolly.scalajs.react.hooks.Api$Primary.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024 from "./japgolly.scalajs.react.hooks.CustomHook$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First from "./japgolly.scalajs.react.hooks.CustomHook$Builder$First.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024Subsequent from "./japgolly.scalajs.react.hooks.CustomHook$Builder$Subsequent.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024I1 from "./japgolly.scalajs.react.hooks.HookCtx$I1.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF from "./japgolly.scalajs.react.hooks.Hooks$UseStateF.js"; -import * as $j_japgolly$002escalajs$002ereact$002epackage$0024 from "./japgolly.scalajs.react.package$.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite from "./japgolly.scalajs.react.vdom.TagLite.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagMod from "./japgolly.scalajs.react.vdom.TagMod.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; -import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; -import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; -import * as $j_scala$002eFunction1 from "./scala.Function1.js"; - -function $c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$() { - this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook1 = null; - this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook2 = null; - this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook3 = null; - this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_Component = null; - $n_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$ = this; - var this$3 = $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_CustomHook.apply__Ljapgolly_scalajs_react_hooks_CustomHook$Builder$First(); - var initialState = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$1 => { - var _$1$1 = _$1 | 0; - - return 1 + _$1$1 | 0; - }); - var step = new $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First.$c_Ljapgolly_scalajs_react_hooks_CustomHook$Builder$FirstStep(); - this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useStateBy__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$3, initialState, step).buildReturning__F1__F1(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$2 => { - var _$2$1 = _$2; - return _$2$1.Ljapgolly_scalajs_react_hooks_HookCtx$I1__f_hook1; - })); - var this$5 = $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_CustomHook.apply__Ljapgolly_scalajs_react_hooks_CustomHook$Builder$First(); - var initialState$1 = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$3 => { - var _$3$1 = _$3 | 0; - - return _$3$1 << 1; - }); - var step$1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First.$c_Ljapgolly_scalajs_react_hooks_CustomHook$Builder$FirstStep(); - this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useStateBy__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$5, initialState$1, step$1).buildReturning__F1__F1(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$4 => { - var _$4$1 = _$4; - return _$4$1.Ljapgolly_scalajs_react_hooks_HookCtx$I1__f_hook1; - })); - var this$7 = $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_CustomHook.apply__Ljapgolly_scalajs_react_hooks_CustomHook$Builder$First(); - var initialState$2 = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$5 => { - var _$5$1 = _$5 | 0; - - return Math.imul(3, _$5$1); - }); - var step$2 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First.$c_Ljapgolly_scalajs_react_hooks_CustomHook$Builder$FirstStep(); - this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useStateBy__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$7, initialState$2, step$2).buildReturning__F1__F1(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$6 => { - var _$6$1 = _$6; - return _$6$1.Ljapgolly_scalajs_react_hooks_HookCtx$I1__f_hook1; - })); - - var rawComponent = (this$7$1 => props => { - var p = props.a | 0; - - var __japgolly__hook1_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1(this$7$1.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook1, -1 + p | 0); - - var __japgolly__hook1 = __japgolly__hook1_raw.apply__O__O(void 0); - - props.a | 0; - - var __japgolly__hook2_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1(this$7$1.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook2, __japgolly__hook1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); - - var __japgolly__hook2 = __japgolly__hook2_raw.apply__O__O(void 0); - - props.a; - - var __japgolly__hook3_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1(this$7$1.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_customHook3, __japgolly__hook2.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); - - var __japgolly__hook3 = __japgolly__hook3_raw.apply__O__O(void 0); - - var p$2 = props.a | 0; - var sum = ((p$2 + (__japgolly__hook1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook2.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook3.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; - var this$15 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); - $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); - $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); - var self = "div"; - var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum))])); - var this$16 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$15, self, xs); - return this$16.rawElement__Ljapgolly_scalajs_react_facade_React$Element(); - })(this); - - var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); - var this$17 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); - var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); - this.Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$17.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); -} - -export { $c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$ }; -$c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$.prototype = new $j_java$002elang$002eObject.$h_O(); -$c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$; - -function $h_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$() {} - -export { $h_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$ }; -$h_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$.prototype; -var $d_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$ = new $j_java$002elang$002eObject.$TypeData().initClass({ - Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$: 0 -}, false, "japgolly.scalajs.react.test.emissions.CustomHooksBy$", { - Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$: 1, - O: 1 -}); -export { $d_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$ }; -$c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$; -var $n_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$; - -function $m_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$() { - if (!$n_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$) { - $n_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$ = new $c_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$(); - } - - ; - return $n_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$; -} - -export { $m_Ljapgolly_scalajs_react_test_emissions_CustomHooksBy$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out2.js index 69131efd9..f9b1c3bea 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out2.js @@ -9,8 +9,11 @@ import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from " import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002efeature$002eContext$0024$0024anon$00243 from "./japgolly.scalajs.react.feature.Context$$anon$3.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P5 from "./japgolly.scalajs.react.hooks.HookCtx$P5.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P8 from "./japgolly.scalajs.react.hooks.HookCtx$P8.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer from "./japgolly.scalajs.react.hooks.Hooks$UseReducer.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseReducer$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 from "./japgolly.scalajs.react.internal.Singleton$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; @@ -67,6 +70,18 @@ $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$.prototype.japgolly$scala return (($$x2 | 0) + ($$x1 | 0) | 0) + (this$2.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0; }; +$c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$.prototype.japgolly$scalajs$react$test$emissions$HooksTrivial$$$anonfun$Component$9__Ljapgolly_scalajs_react_internal_Box__I__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__Ljapgolly_scalajs_react_internal_Box = function (props$1, __japgolly__hook1$1, __japgolly__hook9$1) { + return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(((props$1.a | 0) + __japgolly__hook1$1 | 0) + (__japgolly__hook9$1.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0); +}; + +$c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$.prototype.japgolly$scalajs$react$test$emissions$HooksTrivial$$$anonfun$Component$10__Ljapgolly_scalajs_react_hooks_HookCtx$P8__Ljapgolly_scalajs_react_internal_Box = function (__japgolly__hook12_ctx$1) { + var $$x3 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); + var $$x2 = __japgolly__hook12_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + var $$x1 = __japgolly__hook12_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; + var this$1 = __japgolly__hook12_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P6__f_hook6; + return $$x3.apply__O__Ljapgolly_scalajs_react_internal_Box((($$x2 | 0) + ($$x1 | 0) | 0) + (this$1.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0); +}; + $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$.prototype.japgolly$scalajs$react$test$emissions$HooksTrivial$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s(function (props) { _s(); @@ -130,7 +145,7 @@ $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$.prototype.japgolly$scala var props$3 = props.a; - var __japgolly__hook9_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P5.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P5(props$3, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3, __japgolly__hook7, __japgolly__hook8); + var __japgolly__hook9_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P5.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P5__O__O__O__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P5.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P5(), props$3, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3, __japgolly__hook7, __japgolly__hook8); var $$x3 = $i_react; var $$x2 = $j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$(); @@ -149,11 +164,30 @@ $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$.prototype.japgolly$scala var __japgolly__hook9 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseReducer$().fromJs__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer(__japgolly__hook9_raw); - var sum = ((((__japgolly__hook1 + __japgolly__hook2 | 0) + __japgolly__hook3 | 0) + (__japgolly__hook7.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0) + (__japgolly__hook8.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0) + (__japgolly__hook9.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0; + var __japgolly__hook10_raw = $i_react.useState(() => { + $m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$(); + return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123); + }); + + var __japgolly__hook10 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook10_raw); + + var __japgolly__hook11_raw = $i_react.useState(((props$1$2, __japgolly__hook1$1$1, __japgolly__hook9$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$().japgolly$scalajs$react$test$emissions$HooksTrivial$$$anonfun$Component$9__Ljapgolly_scalajs_react_internal_Box__I__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__Ljapgolly_scalajs_react_internal_Box(props$1$2, __japgolly__hook1$1$1, __japgolly__hook9$1))(props, __japgolly__hook1, __japgolly__hook9)); + + var __japgolly__hook11 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook11_raw); + + var props$4 = props.a; + + var __japgolly__hook12_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P8.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P8(props$4, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3, __japgolly__hook7, __japgolly__hook8, __japgolly__hook9, __japgolly__hook10, __japgolly__hook11); + + var __japgolly__hook12_raw = $i_react.useState((__japgolly__hook12_ctx$1 => () => $m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$().japgolly$scalajs$react$test$emissions$HooksTrivial$$$anonfun$Component$10__Ljapgolly_scalajs_react_hooks_HookCtx$P8__Ljapgolly_scalajs_react_internal_Box(__japgolly__hook12_ctx$1))(__japgolly__hook12_ctx)); + + var __japgolly__hook12 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook12_raw); + + var sum = (((((((__japgolly__hook1 + __japgolly__hook2 | 0) + __japgolly__hook3 | 0) + (__japgolly__hook7.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0) + (__japgolly__hook8.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0) + (__japgolly__hook9.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0) + (__japgolly__hook10.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook11.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook12.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0; $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); return new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; -}, "hviLnwV7rVkoQrGLOuNFxEV4+eM="); +}, "uT9KyDdFiYqspHjXIr3EA6BrVVg="); var $d_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$ = new $j_java$002elang$002eObject.$TypeData().initClass({ Ljapgolly_scalajs_react_test_emissions_HooksTrivial$: 0 }, false, "japgolly.scalajs.react.test.emissions.HooksTrivial$", { diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out3.js index e38434672..cdfcd1929 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out3.js @@ -7,8 +7,11 @@ import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from " import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002efeature$002eContext$0024$0024anon$00243 from "./japgolly.scalajs.react.feature.Context$$anon$3.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P5 from "./japgolly.scalajs.react.hooks.HookCtx$P5.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P8 from "./japgolly.scalajs.react.hooks.HookCtx$P8.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer from "./japgolly.scalajs.react.hooks.Hooks$UseReducer.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseReducer$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; @@ -108,7 +111,7 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$() { var props$3 = props.a; - var __japgolly__hook9_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P5.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P5(props$3, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3, __japgolly__hook7, __japgolly__hook8); + var __japgolly__hook9_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P5.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P5__O__O__O__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P5.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P5(), props$3, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3, __japgolly__hook7, __japgolly__hook8); var $$x4 = $i_react; var $$x3 = $j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$(); @@ -129,16 +132,42 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$() { var __japgolly__hook9 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseReducer$().fromJs__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer(__japgolly__hook9_raw); + var __japgolly__hook10_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); + + var __japgolly__hook10 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook10_raw); + + var __japgolly__hook11_raw = $i_react.useState(((props$3$1, __japgolly__hook1$3, __japgolly__hook9$2) => () => { + var $$x7 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); + var p$1 = props$3$1.a | 0; + return $$x7.apply__O__Ljapgolly_scalajs_react_internal_Box((p$1 + __japgolly__hook1$3 | 0) + (__japgolly__hook9$2.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0); + })(props, __japgolly__hook1, __japgolly__hook9)); + + var __japgolly__hook11 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook11_raw); + + var props$4 = props.a; + + var __japgolly__hook12_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P8.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P8(props$4, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3, __japgolly__hook7, __japgolly__hook8, __japgolly__hook9, __japgolly__hook10, __japgolly__hook11); + + var __japgolly__hook12_raw = $i_react.useState((__japgolly__hook12_ctx$2 => () => { + var $$x10 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); + var $$x9 = __japgolly__hook12_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + var $$x8 = __japgolly__hook12_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; + var this$12 = __japgolly__hook12_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P6__f_hook6; + return $$x10.apply__O__Ljapgolly_scalajs_react_internal_Box((($$x9 | 0) + ($$x8 | 0) | 0) + (this$12.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0); + })(__japgolly__hook12_ctx)); + + var __japgolly__hook12 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook12_raw); + props.a | 0; - var sum = ((((__japgolly__hook1 + __japgolly__hook2 | 0) + __japgolly__hook3 | 0) + (__japgolly__hook7.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0) + (__japgolly__hook8.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0) + (__japgolly__hook9.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0; + var sum = (((((((__japgolly__hook1 + __japgolly__hook2 | 0) + __japgolly__hook3 | 0) + (__japgolly__hook7.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0) + (__japgolly__hook8.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0) + (__japgolly__hook9.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0) + (__japgolly__hook10.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook11.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook12.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; return ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; - }, "hviLnwV7rVkoQrGLOuNFxEV4+eM="); + }, "VsPHAjG/W+fVD7Fw7mi6+4TlBvM="); })(this); - var $$x7 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); - var this$13 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var $$x11 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$15 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); - this.Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_Component = $$x7.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$13.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); + this.Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_Component = $$x11.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$15.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); } export { $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$ }; diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala index e0965953e..3e54b9d91 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala @@ -25,7 +25,6 @@ object ReactRefreshTest extends TestSuite { "sjr" - { "CustomHooks" - testScala(assertRR = false) // TODO: - "CustomHooksBy" - testScala(assertRR = false) // TODO: "HooksPrimative" - testScala(assertRR = false) // TODO: "HooksTrivial" - testScala() "HooksWithChildrenCtxFn" - testScala() @@ -36,7 +35,6 @@ object ReactRefreshTest extends TestSuite { "JustPropsViaHookApi" - testScala(assertRR = false) // TODO: "UseCallback" - testScala() "UseMemo" - testScala() - "UseState" - testScala() "UseStateWithReuse" - testScala() } } From 5c17b042084d01ae7804de7a258175c5b1e30524 Mon Sep 17 00:00:00 2001 From: David Barri Date: Thu, 23 Jun 2022 11:13:46 +1000 Subject: [PATCH 63/72] `use*Effect*` --- library/TODO.md | 21 --- .../scalajs/react/hooks/HookMacros.scala | 9 + .../scalajs/react/hooks/HookMacros.scala | 9 + .../react/hooks/AbstractHookMacros.scala | 43 +++++ .../scalajs/react/test/emissions/Main.scala | 1 + .../react/test/emissions/UseEffect.scala | 30 ++++ .../test/resources/rr-sjr/UseEffect-out2.js | 101 +++++++++++ .../test/resources/rr-sjr/UseEffect-out3.js | 158 ++++++++++++++++++ .../test/emissions/ReactRefreshTest.scala | 1 + 9 files changed, 352 insertions(+), 21 deletions(-) create mode 100644 library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseEffect.scala create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/UseEffect-out2.js create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/UseEffect-out3.js diff --git a/library/TODO.md b/library/TODO.md index 9068c8c47..c557e7aba 100644 --- a/library/TODO.md +++ b/library/TODO.md @@ -1,29 +1,8 @@ ```scala // Api.scala -def useEffect [A](effect: A)(implicit a: UseEffectArg[A], step: Step): step.Self -def useEffectBy [A](init: Ctx => A)(implicit a: UseEffectArg[A], step: Step): step.Self -def useEffectBy [A](init: CtxFn[A])(implicit a: UseEffectArg[A], step: Step): step.Self -def useEffectOnMount [A](effect: A)(implicit a: UseEffectArg[A], step: Step): step.Self -def useEffectOnMountBy [A](effect: Ctx => A)(implicit a: UseEffectArg[A], step: Step): step.Self -def useEffectOnMountBy [A](effect: CtxFn[A])(implicit a: UseEffectArg[A], step: Step): step.Self def useForceUpdate (implicit step: Step): step.Next[Reusable[DefaultEffects.Sync[Unit]]] -def useEffectWithDeps [D, A](deps: => D)(effect: D => A)(implicit a: UseEffectArg[A], r: Reusability[D], step: Step): step.Self -def useEffectWithDepsBy [D, A](deps: Ctx => D)(effect: Ctx => D => A)(implicit a: UseEffectArg[A], r: Reusability[D], step: Step): step.Self -def useEffectWithDepsBy [D, A](deps: CtxFn[D])(effect: CtxFn[D => A])(implicit a: UseEffectArg[A], r: Reusability[D], step: Step): step.Self - -def useLayoutEffect [A](effect: A)(implicit a: UseEffectArg[A], step: Step): step.Self -def useLayoutEffectBy [A](init: Ctx => A)(implicit a: UseEffectArg[A], step: Step): step.Self -def useLayoutEffectBy [A](init: CtxFn[A])(implicit a: UseEffectArg[A], step: Step): step.Self -def useLayoutEffectOnMount [A](effect: A)(implicit a: UseEffectArg[A], step: Step): step.Self -def useLayoutEffectOnMountBy [A](effect: Ctx => A)(implicit a: UseEffectArg[A], step: Step): step.Self -def useLayoutEffectOnMountBy [A](effect: CtxFn[A])(implicit a: UseEffectArg[A], step: Step): step.Self - -def useLayoutEffectWithDeps [D, A](deps: => D)(effect: D => A)(implicit a: UseEffectArg[A], r: Reusability[D], step: Step): step.Self -def useLayoutEffectWithDepsBy [D, A](deps: Ctx => D)(effect: Ctx => D => A)(implicit a: UseEffectArg[A], r: Reusability[D], step: Step): step.Self -def useLayoutEffectWithDepsBy [D, A](deps: CtxFn[D])(effect: CtxFn[D => A])(implicit a: UseEffectArg[A], r: Reusability[D], step: Step): step.Self - def useRef [A](initialValue: => A)(implicit step: Step): step.Next[UseRef[A]] def useRefBy [A](f: CtxFn[A])(implicit step: Step): step.Next[UseRef[A]] def useRefBy [A](initialValue: Ctx => A)(implicit step: Step): step.Next[UseRef[A]] diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala index 77cab4873..936bb083a 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -224,6 +224,15 @@ class HookMacros(val c: Context) extends MacroUtils { override protected def useDebugValue = desc => q"$React.useDebugValue[Null](null, _ => $desc)" + override protected def useEffect = (a, d) => + q"$React.useEffect($a, $d)" + + override protected def useEffectArgToJs[A] = (arg, a, _) => + q"$arg.toJs($a)" + + override protected def useLayoutEffect = (a, d) => + q"$React.useLayoutEffect($a, $d)" + override protected def useMemo[A] = (a, d, _) => q"$React.useMemo(() => $a, $d)" diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala index 4152a10b8..70c2ae78a 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala @@ -332,6 +332,15 @@ object HookMacros { override protected def useDebugValue = desc => '{ React.useDebugValue[Null](null, _ => $desc) } + override protected def useEffect = implicit (a, d) => + '{ React.useEffect($a, $d) } + + override protected def useEffectArgToJs[A] = implicit (arg, a, tpeA) => + '{ $arg.toJs($a) } + + override protected def useLayoutEffect = implicit (a, d) => + '{ React.useLayoutEffect($a, $d) } + override protected def useMemo[A] = implicit (a, d, tpeA) => '{ React.useMemo(() => $a, $d) } diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala index 38aeb5348..026a27013 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala @@ -467,6 +467,40 @@ trait AbstractHookMacros { b.createHook(useDebugValue(withCtx(descFn)), discard = true) } + case "useEffect" + | "useEffectBy" + | "useEffectOnMount" + | "useEffectOnMountBy" + | "useLayoutEffect" + | "useLayoutEffectBy" + | "useLayoutEffectOnMount" + | "useLayoutEffectOnMountBy" => + val (List(tpe), List(List(effectFn), List(arg, _))) = step.sig : @nowarn + maybeBy(effectFn) { (b, withCtx) => + val hook = if (step.name.contains("Layout")) useLayoutEffect else useEffect + val hookDeps = if (step.name.contains("Mount")) hookDepsEmptyArray else hookDepsUndefined + val effect = withCtx(effectFn) + val effectJs = useEffectArgToJs[X](arg, effect, tpe) + b.createHook(hook(effectJs, hookDeps), discard = true) + None + } + + case "useEffectWithDeps" + | "useEffectWithDepsBy" + | "useLayoutEffectWithDeps" + | "useLayoutEffectWithDepsBy" => + val (List(tpeD, tpeA), List(List(depsFn), List(effectFnFn), List(arg, reuse, _))) = step.sig : @nowarn + maybeBy(effectFnFn) { (b, withCtx) => + val hook = if (step.name.contains("Layout")) useLayoutEffect else useEffect + val (deps, rev) = reusableDeps[X](b, withCtx(depsFn), reuse, tpeD) + val hookDeps = hookDepsIntArray1(rev) + val effectFn = withCtx(effectFnFn) + val effect = call(effectFn, deps :: Nil, false) + val effectJs = useEffectArgToJs[X](arg, effect, tpeA) + b.createHook(hook(effectJs, hookDeps), discard = true) + None + } + case "useMemo" | "useMemoBy" => val (List(tpeD, tpeA), List(List(depsFn), List(createFnFn), List(reuse, _))) = step.sig : @nowarn maybeBy(depsFn) { (b, withCtx) => @@ -516,6 +550,9 @@ trait AbstractHookMacros { protected def hookDepsIntArray1: Expr[Int] => Expr[HookDeps] + protected def hookDepsUndefined: Expr[HookDeps] = + unitTerm.asInstanceOf[Expr[HookDeps]] + protected def hooksVar[A]: (Type[A], Expr[A]) => Expr[Hooks.Var[A]] protected def none[A]: Type[Option[A]] => Expr[Option[A]] @@ -546,6 +583,12 @@ trait AbstractHookMacros { protected def useDebugValue: Expr[Any] => Expr[Unit] + protected def useEffect: (Expr[React.UseEffectArg], Expr[HookDeps]) => Expr[Unit] + + protected def useEffectArgToJs[A]: (Expr[Hooks.UseEffectArg[A]], Expr[A], Type[A]) => Expr[React.UseEffectArg] + + protected def useLayoutEffect: (Expr[React.UseEffectArg], Expr[HookDeps]) => Expr[Unit] + protected def useMemo[A]: (Expr[A], Expr[HookDeps], Type[A]) => Expr[A] protected def useReducer[S, A]: (Expr[(S, A) => S], Expr[S], Type[S], Type[A]) => Expr[React.UseReducer[S, A]] diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala index 7f353cc79..f8788e47b 100644 --- a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala @@ -24,6 +24,7 @@ object Main { JustPropsChildrenViaHookApi.Component(0)(<.div), JustPropsViaHookApi .Component(0), UseCallback .Component(0), + UseEffect .Component(0), UseMemo .Component(0), UseStateWithReuse .Component(0), ) diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseEffect.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseEffect.scala new file mode 100644 index 000000000..63f51f861 --- /dev/null +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseEffect.scala @@ -0,0 +1,30 @@ +package japgolly.scalajs.react.test.emissions + +import japgolly.scalajs.react._ +import japgolly.scalajs.react.vdom.html_<^._ + +object UseEffect { + + val Component = ScalaFnComponent.withHooks[Int] + + .useEffect(Callback.empty) + .useEffectOnMount(Callback.empty) + .useLayoutEffect(Callback.empty) + .useLayoutEffectOnMount(Callback.empty) + + .useEffectBy(Callback.log(_)) + .useEffectOnMountBy(Callback.log(_)) + .useLayoutEffectBy(Callback.log(_)) + .useLayoutEffectOnMountBy(Callback.log(_)) + + .unchecked(0) + + .useEffectBy($ => Callback.log($.props)) + .useEffectOnMountBy($ => Callback.log($.props)) + .useLayoutEffectBy($ => Callback.log($.props)) + .useLayoutEffectOnMountBy($ => Callback.log($.props)) + + .renderRR { (p, s) => + p + s + } +} diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseEffect-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseEffect-out2.js new file mode 100644 index 000000000..2fe4d94d5 --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseEffect-out2.js @@ -0,0 +1,101 @@ +'use strict'; + +var _s = $RefreshSig$(); + +import * as $i_react from "react"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseEffectArg$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 from "./japgolly.scalajs.react.internal.Singleton$.js"; +import * as $j_japgolly$002escalajs$002ereact$002epackage$0024 from "./japgolly.scalajs.react.package$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024 from "./japgolly.scalajs.react.util.EffectCallback$callback$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; + +function $c_Ljapgolly_scalajs_react_test_emissions_UseEffect$() { + this.Ljapgolly_scalajs_react_test_emissions_UseEffect$__f_Component = null; + $n_Ljapgolly_scalajs_react_test_emissions_UseEffect$ = this; + + var rawComponent = arg1$2 => $m_Ljapgolly_scalajs_react_test_emissions_UseEffect$().japgolly$scalajs$react$test$emissions$UseEffect$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2); + + var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$(), null)); + this.Ljapgolly_scalajs_react_test_emissions_UseEffect$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$1.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_UseEffect$ }; +$c_Ljapgolly_scalajs_react_test_emissions_UseEffect$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_UseEffect$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_UseEffect$; + +function $h_Ljapgolly_scalajs_react_test_emissions_UseEffect$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_UseEffect$ }; +$h_Ljapgolly_scalajs_react_test_emissions_UseEffect$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_UseEffect$.prototype; +$c_Ljapgolly_scalajs_react_test_emissions_UseEffect$.prototype.japgolly$scalajs$react$test$emissions$UseEffect$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s(function (props) { + _s(); + + $i_react.useEffect($j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()).apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.Ljapgolly_scalajs_react_callback_Callback$__f_empty)), void 0); + var $$x2 = $i_react; + var $$x1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()).apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.Ljapgolly_scalajs_react_callback_Callback$__f_empty)); + var a = []; + $$x2.useEffect($$x1, a); + $i_react.useLayoutEffect($j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()).apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.Ljapgolly_scalajs_react_callback_Callback$__f_empty)), void 0); + var $$x4 = $i_react; + var $$x3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()).apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.Ljapgolly_scalajs_react_callback_Callback$__f_empty)); + var a$1 = []; + $$x4.useLayoutEffect($$x3, a$1); + $i_react.useEffect($j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()).apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline(props.a, $j_java$002elang$002eCharacter$0024.$m_sci_Nil$()))), void 0); + var $$x6 = $i_react; + var $$x5 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()).apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline(props.a, $j_java$002elang$002eCharacter$0024.$m_sci_Nil$()))); + var a$2 = []; + $$x6.useEffect($$x5, a$2); + $i_react.useLayoutEffect($j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()).apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline(props.a, $j_java$002elang$002eCharacter$0024.$m_sci_Nil$()))), void 0); + var $$x8 = $i_react; + var $$x7 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()).apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline(props.a, $j_java$002elang$002eCharacter$0024.$m_sci_Nil$()))); + var a$3 = []; + $$x8.useLayoutEffect($$x7, a$3); + var props$1 = props.a; + $i_react.useEffect($j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()).apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline(props$1, $j_java$002elang$002eCharacter$0024.$m_sci_Nil$()))), void 0); + var props$2 = props.a; + var $$x10 = $i_react; + var $$x9 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()).apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline(props$2, $j_java$002elang$002eCharacter$0024.$m_sci_Nil$()))); + var a$4 = []; + $$x10.useEffect($$x9, a$4); + var props$3 = props.a; + $i_react.useLayoutEffect($j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()).apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline(props$3, $j_java$002elang$002eCharacter$0024.$m_sci_Nil$()))), void 0); + var props$4 = props.a; + var $$x12 = $i_react; + var $$x11 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()).apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline(props$4, $j_java$002elang$002eCharacter$0024.$m_sci_Nil$()))); + var a$5 = []; + $$x12.useLayoutEffect($$x11, a$5); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + var v = props.a | 0; + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + return new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(v).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; +}, "k1mMCyODKidP5cenhTaO0cNn/yI="); +var $d_Ljapgolly_scalajs_react_test_emissions_UseEffect$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_UseEffect$: 0 +}, false, "japgolly.scalajs.react.test.emissions.UseEffect$", { + Ljapgolly_scalajs_react_test_emissions_UseEffect$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_UseEffect$ }; +$c_Ljapgolly_scalajs_react_test_emissions_UseEffect$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_UseEffect$; +var $n_Ljapgolly_scalajs_react_test_emissions_UseEffect$; + +function $m_Ljapgolly_scalajs_react_test_emissions_UseEffect$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_UseEffect$) { + $n_Ljapgolly_scalajs_react_test_emissions_UseEffect$ = new $c_Ljapgolly_scalajs_react_test_emissions_UseEffect$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_UseEffect$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_UseEffect$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseEffect-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseEffect-out3.js new file mode 100644 index 000000000..6df708777 --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseEffect-out3.js @@ -0,0 +1,158 @@ +'use strict'; + +import * as $i_react from "react"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024 from "./japgolly.scalajs.react.callback.Trampoline$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay from "./japgolly.scalajs.react.callback.Trampoline$Delay.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P1 from "./japgolly.scalajs.react.hooks.HookCtx$P1.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseEffectArg$.js"; +import * as $j_japgolly$002escalajs$002ereact$002epackage$0024 from "./japgolly.scalajs.react.package$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024 from "./japgolly.scalajs.react.util.EffectCallback$callback$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; +import * as $j_scala$002escalajs$002eruntime$002eCompat$0024 from "./scala.scalajs.runtime.Compat$.js"; + +function $c_Ljapgolly_scalajs_react_test_emissions_UseEffect$() { + var _s = $RefreshSig$(); + + this.Ljapgolly_scalajs_react_test_emissions_UseEffect$__f_Component = null; + $n_Ljapgolly_scalajs_react_test_emissions_UseEffect$ = this; + + var rawComponent = props => { + _s(); + + $i_react.useEffect($j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()).apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.Ljapgolly_scalajs_react_callback_Callback$package$Callback$__f_empty)), void 0); + $i_react.useEffect($j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()).apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.Ljapgolly_scalajs_react_callback_Callback$package$Callback$__f_empty)), []); + $i_react.useLayoutEffect($j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()).apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.Ljapgolly_scalajs_react_callback_Callback$package$Callback$__f_empty)), void 0); + $i_react.useLayoutEffect($j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()).apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.Ljapgolly_scalajs_react_callback_Callback$package$Callback$__f_empty)), []); + var $$x2 = $i_react; + var $$x1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); + + var _$1 = props.a | 0; + + var optionalParams$proxy1 = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); + var f$proxy3 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((_$1$2, optionalParams$proxy1$2) => () => { + console.log(_$1$2, ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy1$2)); + })(_$1, optionalParams$proxy1)); + $$x2.useEffect($$x1.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy3)))), void 0); + var $$x4 = $i_react; + var $$x3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); + + var _$2 = props.a | 0; + + var optionalParams$proxy2 = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); + var f$proxy6 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((_$2$2, optionalParams$proxy2$2) => () => { + console.log(_$2$2, ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy2$2)); + })(_$2, optionalParams$proxy2)); + $$x4.useEffect($$x3.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy6)))), []); + var $$x6 = $i_react; + var $$x5 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); + + var _$3 = props.a | 0; + + var optionalParams$proxy3 = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); + var f$proxy9 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((_$3$2, optionalParams$proxy3$2) => () => { + console.log(_$3$2, ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy3$2)); + })(_$3, optionalParams$proxy3)); + $$x6.useLayoutEffect($$x5.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy9)))), void 0); + var $$x8 = $i_react; + var $$x7 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); + + var _$4 = props.a | 0; + + var optionalParams$proxy4 = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); + var f$proxy12 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((_$4$2, optionalParams$proxy4$2) => () => { + console.log(_$4$2, ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy4$2)); + })(_$4, optionalParams$proxy4)); + $$x8.useLayoutEffect($$x7.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy12)))), []); + var props$1 = props.a; + + var __japgolly__hook10_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P1.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P1__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P1.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P1(), props$1, 0); + + var $$x10 = $i_react; + var $$x9 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); + var optionalParams$proxy5 = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); + var f$proxy15 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((__japgolly__hook10_ctx$2, optionalParams$proxy5$2) => () => { + console.log(__japgolly__hook10_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props, ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy5$2)); + })(__japgolly__hook10_ctx, optionalParams$proxy5)); + $$x10.useEffect($$x9.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy15)))), void 0); + var props$2 = props.a; + + var __japgolly__hook11_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P1.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P1__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P1.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P1(), props$2, 0); + + var $$x12 = $i_react; + var $$x11 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); + var optionalParams$proxy6 = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); + var f$proxy18 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((__japgolly__hook11_ctx$2, optionalParams$proxy6$2) => () => { + console.log(__japgolly__hook11_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props, ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy6$2)); + })(__japgolly__hook11_ctx, optionalParams$proxy6)); + $$x12.useEffect($$x11.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy18)))), []); + var props$3 = props.a; + + var __japgolly__hook12_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P1.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P1__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P1.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P1(), props$3, 0); + + var $$x14 = $i_react; + var $$x13 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); + var optionalParams$proxy7 = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); + var f$proxy21 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((__japgolly__hook12_ctx$2, optionalParams$proxy7$2) => () => { + console.log(__japgolly__hook12_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props, ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy7$2)); + })(__japgolly__hook12_ctx, optionalParams$proxy7)); + $$x14.useLayoutEffect($$x13.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy21)))), void 0); + var props$4 = props.a; + + var __japgolly__hook13_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P1.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P1__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P1.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P1(), props$4, 0); + + var $$x16 = $i_react; + var $$x15 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); + var optionalParams$proxy8 = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); + var f$proxy24 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((__japgolly__hook13_ctx$2, optionalParams$proxy8$2) => () => { + console.log(__japgolly__hook13_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props, ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy8$2)); + })(__japgolly__hook13_ctx, optionalParams$proxy8)); + $$x16.useLayoutEffect($$x15.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy24)))), []); + var p = props.a | 0; + return ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(p)).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; + }; + + _s(rawComponent, "k1mMCyODKidP5cenhTaO0cNn/yI="); + + var $$x17 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$37 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); + this.Ljapgolly_scalajs_react_test_emissions_UseEffect$__f_Component = $$x17.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$37.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_UseEffect$ }; +$c_Ljapgolly_scalajs_react_test_emissions_UseEffect$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_UseEffect$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_UseEffect$; + +function $h_Ljapgolly_scalajs_react_test_emissions_UseEffect$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_UseEffect$ }; +$h_Ljapgolly_scalajs_react_test_emissions_UseEffect$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_UseEffect$.prototype; +var $d_Ljapgolly_scalajs_react_test_emissions_UseEffect$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_UseEffect$: 0 +}, false, "japgolly.scalajs.react.test.emissions.UseEffect$", { + Ljapgolly_scalajs_react_test_emissions_UseEffect$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_UseEffect$ }; +$c_Ljapgolly_scalajs_react_test_emissions_UseEffect$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_UseEffect$; +var $n_Ljapgolly_scalajs_react_test_emissions_UseEffect$; + +function $m_Ljapgolly_scalajs_react_test_emissions_UseEffect$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_UseEffect$) { + $n_Ljapgolly_scalajs_react_test_emissions_UseEffect$ = new $c_Ljapgolly_scalajs_react_test_emissions_UseEffect$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_UseEffect$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_UseEffect$ }; diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala index 3e54b9d91..c24c8cc3c 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala @@ -34,6 +34,7 @@ object ReactRefreshTest extends TestSuite { "JustPropsChildrenViaHookApi" - testScala(assertRR = false) // TODO: "JustPropsViaHookApi" - testScala(assertRR = false) // TODO: "UseCallback" - testScala() + "UseEffect" - testScala() "UseMemo" - testScala() "UseStateWithReuse" - testScala() } From 63c5df69d50bd7f601b67943f3709f238e93bbb9 Mon Sep 17 00:00:00 2001 From: David Barri Date: Thu, 23 Jun 2022 12:51:19 +1000 Subject: [PATCH 64/72] `useForceUpdate` take 2 --- library/TODO.md | 2 -- .../scalajs/react/hooks/HookMacros.scala | 6 +++++ .../scalajs/react/hooks/HookMacros.scala | 7 +++++ .../react/hooks/AbstractHookMacros.scala | 11 ++++++++ .../scalajs/react/hooks/CustomHook.scala | 7 +++++ .../react/test/emissions/HooksTrivial.scala | 6 +++-- .../resources/rr-sjr/HooksTrivial-out2.js | 20 +++++++++++--- .../resources/rr-sjr/HooksTrivial-out3.js | 26 ++++++++++++++++--- 8 files changed, 74 insertions(+), 11 deletions(-) diff --git a/library/TODO.md b/library/TODO.md index c557e7aba..47d66638e 100644 --- a/library/TODO.md +++ b/library/TODO.md @@ -1,8 +1,6 @@ ```scala // Api.scala -def useForceUpdate (implicit step: Step): step.Next[Reusable[DefaultEffects.Sync[Unit]]] - def useRef [A](initialValue: => A)(implicit step: Step): step.Next[UseRef[A]] def useRefBy [A](f: CtxFn[A])(implicit step: Step): step.Next[UseRef[A]] def useRefBy [A](initialValue: Ctx => A)(implicit step: Step): step.Next[UseRef[A]] diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala index 936bb083a..74504a9eb 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -230,6 +230,12 @@ class HookMacros(val c: Context) extends MacroUtils { override protected def useEffectArgToJs[A] = (arg, a, _) => q"$arg.toJs($a)" + override protected def useForceUpdate1 = + q"$React.useStateValue(0)" + + override protected def useForceUpdate2 = s => + q"$CustomHook.useForceUpdateRaw($s)" + override protected def useLayoutEffect = (a, d) => q"$React.useLayoutEffect($a, $d)" diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala index 70c2ae78a..73b5a5a68 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala @@ -11,6 +11,7 @@ import japgolly.scalajs.react.hooks.CustomHook import japgolly.scalajs.react.hooks.CustomHook.ReusableDepState import japgolly.scalajs.react.hooks.HookCtx import japgolly.scalajs.react.internal.{Box, MacroLogger} +import japgolly.scalajs.react.util.DefaultEffects import japgolly.scalajs.react.vdom.VdomNode import scala.annotation._ import scala.language.`3.1` @@ -338,6 +339,12 @@ object HookMacros { override protected def useEffectArgToJs[A] = implicit (arg, a, tpeA) => '{ $arg.toJs($a) } + override protected def useForceUpdate1 = + '{ React.useStateValue(0) } + + override protected def useForceUpdate2 = s => + '{ CustomHook.useForceUpdateRaw($s) } + override protected def useLayoutEffect = implicit (a, d) => '{ React.useLayoutEffect($a, $d) } diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala index 026a27013..a0ddb460b 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala @@ -6,6 +6,7 @@ import japgolly.scalajs.react.facade.React.HookDeps import japgolly.scalajs.react.hooks.CustomHook.ReusableDepState import japgolly.scalajs.react.hooks.Hooks import japgolly.scalajs.react.internal.{Box, MacroLogger} +import japgolly.scalajs.react.util.DefaultEffects import japgolly.scalajs.react.vdom.VdomNode import japgolly.scalajs.react.{Reusability, Reusable} import scala.annotation.{nowarn, tailrec} @@ -501,6 +502,12 @@ trait AbstractHookMacros { None } + case "useForceUpdate" => + Right { b => + val s = b.valDef(useForceUpdate1, "_state") + b.createHook(useForceUpdate2(s)) + } + case "useMemo" | "useMemoBy" => val (List(tpeD, tpeA), List(List(depsFn), List(createFnFn), List(reuse, _))) = step.sig : @nowarn maybeBy(depsFn) { (b, withCtx) => @@ -587,6 +594,10 @@ trait AbstractHookMacros { protected def useEffectArgToJs[A]: (Expr[Hooks.UseEffectArg[A]], Expr[A], Type[A]) => Expr[React.UseEffectArg] + protected def useForceUpdate1: Expr[React.UseState[Int]] + + protected def useForceUpdate2: Expr[React.UseState[Int]] => Expr[Reusable[DefaultEffects.Sync[Unit]]] + protected def useLayoutEffect: (Expr[React.UseEffectArg], Expr[HookDeps]) => Expr[Unit] protected def useMemo[A]: (Expr[A], Expr[HookDeps], Type[A]) => Expr[A] diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/CustomHook.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/CustomHook.scala index 98637ec5a..14a958e65 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/CustomHook.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/CustomHook.scala @@ -1,10 +1,12 @@ package japgolly.scalajs.react.hooks import japgolly.microlibs.types.NaturalComposition +import japgolly.scalajs.react.facade import japgolly.scalajs.react.internal.ShouldComponentUpdateComponent import japgolly.scalajs.react.util.DefaultEffects import japgolly.scalajs.react.vdom.VdomNode import japgolly.scalajs.react.{PropsChildren, Reusability, Reusable} +import scala.scalajs.js final class CustomHook[I, O] private[CustomHook] (val unsafeInit: I => O) extends AnyVal { @@ -222,4 +224,9 @@ object CustomHook { }) } + def useForceUpdateRaw(s: facade.React.UseState[Int]): Reusable[DefaultEffects.Sync[Unit]] = { + @inline def inc: js.Function1[Int, Int] = _ + 1 + Reusable.implicitly(s._1).withLazyValue(DefaultEffects.Sync.delay(s._2(inc))) + } + } diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksTrivial.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksTrivial.scala index 7d42ace89..88380c778 100644 --- a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksTrivial.scala +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/HooksTrivial.scala @@ -26,8 +26,10 @@ object HooksTrivial { .useStateBy((p, a, _, _, _, _, f, _) => p + a + f.value) .useStateBy($ => $.props + $.hook1 + $.hook6.value) - .renderRR { (_, a, b, c, d, e, f, g, h, i) => + .useForceUpdate + + .renderRR { (_, a, b, c, d, e, f, g, h, i, forceUpdate) => val sum = a + b + c + d.value + e.value + f.value + g.value + h.value + i.value - sum + <.div(sum, ^.onClick --> forceUpdate) } } diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out2.js index f9b1c3bea..ed634263a 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out2.js @@ -8,6 +8,7 @@ import * as $j_japgolly$002escalajs$002ereact$002eReact$0024 from "./japgolly.sc import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002efeature$002eContext$0024$0024anon$00243 from "./japgolly.scalajs.react.feature.Context$$anon$3.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024 from "./japgolly.scalajs.react.hooks.CustomHook$.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P5 from "./japgolly.scalajs.react.hooks.HookCtx$P5.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P8 from "./japgolly.scalajs.react.hooks.HookCtx$P8.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer from "./japgolly.scalajs.react.hooks.Hooks$UseReducer.js"; @@ -15,6 +16,10 @@ import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 from "./japgolly.scalajs.react.internal.Singleton$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024 from "./japgolly.scalajs.react.vdom.Attr$EventCallback$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement from "./japgolly.scalajs.react.vdom.VdomElement.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; @@ -22,7 +27,9 @@ import * as $j_java$002elang$002eClassCastException from "./java.lang.ClassCastE import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; import * as $j_scala$002eFunction1 from "./scala.Function1.js"; import * as $j_scala$002escalajs$002ejs$002eAny$0024 from "./scala.scalajs.js.Any$.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; import * as $j_scala$002escalajs$002eruntime$002eAnonFunction2 from "./scala.scalajs.runtime.AnonFunction2.js"; +import * as $j_scala$002escalajs$002eruntime$002eWrappedVarArgs from "./scala.scalajs.runtime.WrappedVarArgs.js"; function $p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2($thiz, n) { return new $j_scala$002escalajs$002eruntime$002eAnonFunction2.$c_sjsr_AnonFunction2((n$1 => (x$1$2, x$2$2) => { @@ -183,11 +190,18 @@ $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$.prototype.japgolly$scala var __japgolly__hook12 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook12_raw); + var __japgolly__hook13_state = $i_react.useState(0); + + var __japgolly__hook13 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().useForceUpdateRaw__sjs_js_Tuple2__Ljapgolly_scalajs_react_Reusable(__japgolly__hook13_state); + var sum = (((((((__japgolly__hook1 + __japgolly__hook2 | 0) + __japgolly__hook3 | 0) + (__japgolly__hook7.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0) + (__japgolly__hook8.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0) + (__japgolly__hook9.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0) + (__japgolly__hook10.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook11.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook12.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0; + var $$x4 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); - $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); - return new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; -}, "uT9KyDdFiYqspHjXIr3EA6BrVVg="); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((__japgolly__hook13$1 => () => __japgolly__hook13$1)(__japgolly__hook13)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().reusableDefaultSync__F1())]; + var this$15 = $$x4.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("div", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); + return $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement.$f_Ljapgolly_scalajs_react_vdom_VdomElement__rawNode__sjs_js_$bar(this$15); +}, "fNOJzNkli90WVir2fr+rau+iRmE=", true); var $d_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$ = new $j_java$002elang$002eObject.$TypeData().initClass({ Ljapgolly_scalajs_react_test_emissions_HooksTrivial$: 0 }, false, "japgolly.scalajs.react.test.emissions.HooksTrivial$", { diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out3.js index cdfcd1929..a3b209de2 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out3.js @@ -6,19 +6,27 @@ import * as $j_japgolly$002escalajs$002ereact$002eReact$0024 from "./japgolly.sc import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; import * as $j_japgolly$002escalajs$002ereact$002efeature$002eContext$0024$0024anon$00243 from "./japgolly.scalajs.react.feature.Context$$anon$3.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024 from "./japgolly.scalajs.react.hooks.CustomHook$.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P5 from "./japgolly.scalajs.react.hooks.HookCtx$P5.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P8 from "./japgolly.scalajs.react.hooks.HookCtx$P8.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer from "./japgolly.scalajs.react.hooks.Hooks$UseReducer.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseReducer$.js"; import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024 from "./japgolly.scalajs.react.vdom.Attr$EventCallback$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite from "./japgolly.scalajs.react.vdom.TagLite.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagMod from "./japgolly.scalajs.react.vdom.TagMod.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; import * as $j_java$002elang$002eClassCastException from "./java.lang.ClassCastException.js"; import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; import * as $j_scala$002eFunction1 from "./scala.Function1.js"; import * as $j_scala$002escalajs$002ejs$002eAny$0024 from "./scala.scalajs.js.Any$.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; import * as $j_scala$002escalajs$002eruntime$002eAnonFunction2 from "./scala.scalajs.runtime.AnonFunction2.js"; function $p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2($thiz, n) { @@ -158,16 +166,26 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$() { var __japgolly__hook12 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook12_raw); + var __japgolly__hook13_state = $i_react.useState(0); + + var __japgolly__hook13 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().useForceUpdateRaw__sjs_js_Tuple2__Ljapgolly_scalajs_react_Reusable(__japgolly__hook13_state); + props.a | 0; var sum = (((((((__japgolly__hook1 + __japgolly__hook2 | 0) + __japgolly__hook3 | 0) + (__japgolly__hook7.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0) + (__japgolly__hook8.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0) + (__japgolly__hook9.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0) + (__japgolly__hook10.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook11.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook12.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; - return ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; - }, "VsPHAjG/W+fVD7Fw7mi6+4TlBvM="); + var this$17 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self = "div"; + var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((__japgolly__hook13$2 => () => __japgolly__hook13$2)(__japgolly__hook13)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().reusableDefaultSync__F1())])); + var this$18 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$17, self, xs); + return this$18.rawElement__Ljapgolly_scalajs_react_facade_React$Element(); + }, "JpVURmOEfTlG2I9fy8EuJSQSlcs=", true); })(this); var $$x11 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); - var this$15 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var this$19 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); - this.Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_Component = $$x11.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$15.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); + this.Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_Component = $$x11.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$19.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); } export { $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$ }; From a8693f45d2216857200578cfe2094da7bf1161e9 Mon Sep 17 00:00:00 2001 From: David Barri Date: Fri, 24 Jun 2022 10:11:40 +1000 Subject: [PATCH 65/72] Support `useRef*` --- bin/ci | 4 +- bin/mima | 39 ++++ .../mima200/HookUseRefToJsComponent.scala | 16 ++ library/TODO.md | 11 - .../scalajs/react/hooks/HookMacros.scala | 58 ++++- .../scalajs/react/hooks/HookMacros.scala | 57 ++++- .../react/hooks/AbstractHookMacros.scala | 140 ++++++++++++- .../japgolly/scalajs/react/hooks/Api.scala | 6 +- .../scalajs/react/hooks/CustomHook.scala | 3 +- .../japgolly/scalajs/react/hooks/Hooks.scala | 5 +- .../scalajs/react/test/emissions/Main.scala | 1 + .../scalajs/react/test/emissions/UseRef.scala | 32 +++ .../src/test/resources/rr-sjr/UseRef-out2.js | 138 ++++++++++++ .../src/test/resources/rr-sjr/UseRef-out3.js | 198 ++++++++++++++++++ .../test/emissions/ReactRefreshTest.scala | 1 + .../scalajs/react/core/HooksRRTest.scala | 39 +++- 16 files changed, 719 insertions(+), 29 deletions(-) create mode 100755 bin/mima create mode 100644 downstream-tests/mima-2.0.0/src/main/scala/downstream/mima200/HookUseRefToJsComponent.scala create mode 100644 library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseRef.scala create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/UseRef-out2.js create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/UseRef-out3.js diff --git a/bin/ci b/bin/ci index 5a3ea1b3b..c0322ed46 100755 --- a/bin/ci +++ b/bin/ci @@ -13,10 +13,10 @@ fi case "${1:-}" in "") - "$0" 2 + ../bin/"$0" 2 echo echo - "$0" 3 + ../bin/"$0" 3 exit 0 ;; 2|3) diff --git a/bin/mima b/bin/mima new file mode 100755 index 000000000..83a26bf9e --- /dev/null +++ b/bin/mima @@ -0,0 +1,39 @@ +#!/bin/bash +set -euo pipefail +cd "$(dirname "$0")/../library" + +if [ $# -gt 1 ]; then + echo "Usage: $0 []" + echo "" + echo "Where" + echo " = 2 or 3" + echo + exit 1 +fi + +case "${1:-}" in + "") + ../bin/"$0" 2 + echo + echo + ../bin/"$0" 3 + exit 0 + ;; + 2|3) + SCALA_VER="$(../bin/get_scala_version $1)" + echo "Scala version: $SCALA_VER" + ;; + *) + echo "Unrecognised version: $1" >&2 + exit 2 + ;; +esac + +# Test upstream +# rm -rf */target/scala-*/{,test-}classes +sbt ++$SCALA_VER publishLocal + +# Test downstream +SCALA_MAJOR_VER="${SCALA_VER:0:1}" +cd ../downstream-tests +sbt ++$SCALA_VER mima200/clean mima200/fastOptJS diff --git a/downstream-tests/mima-2.0.0/src/main/scala/downstream/mima200/HookUseRefToJsComponent.scala b/downstream-tests/mima-2.0.0/src/main/scala/downstream/mima200/HookUseRefToJsComponent.scala new file mode 100644 index 000000000..749c7c524 --- /dev/null +++ b/downstream-tests/mima-2.0.0/src/main/scala/downstream/mima200/HookUseRefToJsComponent.scala @@ -0,0 +1,16 @@ +package downstream.mima200 + +import japgolly.scalajs.react._ +import japgolly.scalajs.react.vdom.html_<^._ + +// Because `useRefToJsComponent` didn't need the `CT0` arg so I removed it. +object HookUseRefToJsComponent { + + val jsComp = JsComponent.force[Null, Children.None, Null](null) + + val comp = ScalaFnComponent.withHooks[Unit] + .useRefToJsComponent(jsComp) + .render { (_, ref) => + jsComp.withRef(ref)() + } +} diff --git a/library/TODO.md b/library/TODO.md index 47d66638e..7f7194e5a 100644 --- a/library/TODO.md +++ b/library/TODO.md @@ -1,17 +1,6 @@ ```scala // Api.scala -def useRef [A](initialValue: => A)(implicit step: Step): step.Next[UseRef[A]] -def useRefBy [A](f: CtxFn[A])(implicit step: Step): step.Next[UseRef[A]] -def useRefBy [A](initialValue: Ctx => A)(implicit step: Step): step.Next[UseRef[A]] -def useRefToAnyVdom (implicit step: Step): step.Next[Ref.ToAnyVdom] -def useRefToJsComponent [F[_], A[_], P1, S1, CT1[-p, +u] <: CtorType[p, u], R <: JsComponent.RawMounted[P0, S0], P0 <: js.Object, S0 <: js.Object, CT0[-p, +u] <: CtorType[p, u -def useRefToJsComponent [P <: js.Object, S <: js.Object](implicit step: Step): step.Next[Ref.ToJsComponent[P, S, JsComponent.RawMounted[P, S]]] -def useRefToJsComponentWithMountedFacade[P <: js.Object, S <: js.Object, F <: js.Object](implicit step: Step): step.Next[Ref.ToJsComponent[P, S, JsComponent.RawMounted[P, S] with F]] -def useRefToScalaComponent [P, S, B, CT[-p, +u] <: CtorType[p, u -def useRefToScalaComponent [P, S, B](implicit step: Step): step.Next[Ref.ToScalaComponent[P, S, B]] -def useRefToVdom [N <: TopNode: ClassTag](implicit step: Step): step.Next[Ref.ToVdom[N]] - def renderReusable [A](f: Ctx => Reusable[A])(implicit s: CtorType.Summoner[Box[P], C], v: A => VdomNode): Component[P, s.CT] def renderReusable [A](f: CtxFn[Reusable[A]])(implicit step: Step, s: CtorType.Summoner[Box[P], C], v: A => VdomNode): Component[P, s.CT] diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala index 74504a9eb..4308d5cf0 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -1,13 +1,19 @@ package japgolly.scalajs.react.hooks import japgolly.microlibs.compiletime.MacroUtils -import japgolly.scalajs.react.Children +import japgolly.scalajs.react.component.{Js => JsComponent, Scala => ScalaComponent} import japgolly.scalajs.react.hooks.Api._ import japgolly.scalajs.react.hooks.CustomHook.ReusableDepState import japgolly.scalajs.react.internal.{Box, MacroLogger} +import japgolly.scalajs.react.vdom.TopNode +import japgolly.scalajs.react.{Children, CtorType} import scala.reflect.macros.blackbox.Context import scala.scalajs.js +object HookMacros { + type With[A, B] = A with B +} + class HookMacros(val c: Context) extends MacroUtils { import c.universe._ @@ -48,16 +54,19 @@ class HookMacros(val c: Context) extends MacroUtils { private implicit def autoTagToType[A](t: c.WeakTypeTag[A]): Type = t.tpe + private def AHM : Tree = q"_root_.japgolly.scalajs.react.hooks.AbstractHookMacros" private def Box : Tree = q"_root_.japgolly.scalajs.react.internal.Box" private def Box(t: Type) : Type = appliedType(c.typeOf[Box[_]], t) private def CustomHook : Tree = q"_root_.japgolly.scalajs.react.hooks.CustomHook" private def HookCtx : Tree = q"_root_.japgolly.scalajs.react.hooks.HookCtx" private def Hooks : Tree = q"_root_.japgolly.scalajs.react.hooks.Hooks" + private def JsComp : Tree = q"_root_.japgolly.scalajs.react.component.Js" private def JsFn : Tree = q"_root_.japgolly.scalajs.react.component.JsFn" private def PropsChildren: Tree = q"_root_.japgolly.scalajs.react.PropsChildren" private def React : Tree = q"_root_.japgolly.scalajs.react.facade.React" private def Reusable : Tree = q"_root_.japgolly.scalajs.react.Reusable" private def ScalaFn : Tree = q"_root_.japgolly.scalajs.react.component.ScalaFn" + private def ScalaRef : Tree = q"_root_.japgolly.scalajs.react.Ref" private def SJS : Tree = q"_root_.scala.scalajs.js" private final class HookMacrosImpl extends AbstractHookMacros { @@ -182,12 +191,42 @@ class HookMacros(val c: Context) extends MacroUtils { override protected def hooksVar[A] = (_, body) => q"$Hooks.Var($body)" + override protected def jsComponentRawMountedType[P <: js.Object, S <: js.Object] = (tpeP, tpeS) => + appliedType(c.typeOf[JsComponent.RawMounted[_, _]], tpeP, tpeS) + + override protected def jsComponentRawMountedTypeWithFacade[P <: js.Object, S <: js.Object, F] = (tpeP, tpeS, tpeF) => + appliedType(c.typeOf[HookMacros.With[_, _]], + appliedType(c.typeOf[JsComponent.RawMounted[_, _]], tpeP, tpeS), + tpeF) + override protected def none[A] = _ => q"None" override protected def optionType[A] = a => appliedType(c.typeOf[Option[_]], a) + override protected def refFromJs[A] = (ref, _) => + q"$ScalaRef.fromJs($ref)" + + override protected def refMapJsMounted[P <: js.Object, S <: js.Object] = (ref, _, _) => + q"$ref.map($JsComp.mounted(_))" + + override protected def refMapJsMountedWithFacade[P <: js.Object, S <: js.Object, F <: js.Object] = (ref, tpeP, tpeS, tpeF) => + q"$ref.map(JsComponent.mounted[$tpeP, $tpeS](_).addFacade[$tpeF])" + + override protected def refMapMountedImpure[P, S, B] = (ref, _, _, _) => + q"$ref.map(_.mountedImpure)" + + override protected def refWithJsComponentArgHelper[F[_], A[_], P1, S1, CT1[-p, +u] <: CtorType[p, u], R <: JsComponent.RawMounted[P0, S0], P0 <: js.Object, S0 <: js.Object, CT0[-p, +u] <: CtorType[p, u]] = + (r, a, _, _, _, _, _, _, _, _) => + q"$AHM.helperRefToJsComponent($r, $a)" + + override protected def refNarrowOption[A, B <: A] = (ref, ct, _, tpeB) => + q"$ref.narrowOption[$tpeB]($ct)" + + override protected def refToComponentInject[P, S, B, CT[-p, +u] <: CtorType[p, u]] = (c, r, _, _, _, _) => + q"$AHM.helperRefToComponentInject($c, $r)" + override protected def reusableDepsLogic[D] = (d, s, r, tpeD) => q"$CustomHook.reusableDepsLogic[$tpeD]($d)($s)($r)" @@ -203,6 +242,12 @@ class HookMacros(val c: Context) extends MacroUtils { override protected def reusableValueByInt[A] = (i, a, _) => q"$Reusable.implicitly($i).withValue($a)" + override protected def topNodeType = + c.typeOf[TopNode] + + override protected def scalaComponentRawMountedType[P, S, B] = (tpeS, tpeP, tpeB) => + appliedType(c.typeOf[ScalaComponent.RawMounted[_, _, _]], tpeS, tpeP, tpeB) + override protected def scalaFn0[A] = (_, body) => q"() => $body" @@ -248,6 +293,17 @@ class HookMacros(val c: Context) extends MacroUtils { override protected def useReducerFromJs[S, A] = (raw, _, _) => q"$Hooks.UseReducer.fromJs($raw)" + override protected def useRef[A] = (a, _) => + q"$React.useRef($a)" + + override protected def useRefOrNull[A] = (tpe) => { + val t = appliedType(c.typeOf[js.|[_, _]], tpe, definitions.NullTpe) + q"$React.useRef[$t](null)" + } + + override protected def useRefFromJs[A] = (ref, _) => + q"$Hooks.UseRef.fromJs($ref)" + override protected def useStateFn[S] = (tpe, body) => q"$React.useStateFn(() => $Box[$tpe]($body))" diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala index 73b5a5a68..8a296ba89 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala @@ -1,8 +1,8 @@ package japgolly.scalajs.react.hooks import japgolly.microlibs.compiletime.MacroEnv.* -import japgolly.scalajs.react.{Children, CtorType, PropsChildren, Reusable, Reusability} -import japgolly.scalajs.react.component.{JsFn, ScalaFn} +import japgolly.scalajs.react.{Children, CtorType, PropsChildren, Ref => ScalaRef, Reusable, Reusability} +import japgolly.scalajs.react.component.{Js => JsComponent, JsFn, Scala => ScalaComponent, ScalaFn} import japgolly.scalajs.react.component.ScalaFn.Component import japgolly.scalajs.react.facade import japgolly.scalajs.react.facade.React @@ -12,7 +12,7 @@ import japgolly.scalajs.react.hooks.CustomHook.ReusableDepState import japgolly.scalajs.react.hooks.HookCtx import japgolly.scalajs.react.internal.{Box, MacroLogger} import japgolly.scalajs.react.util.DefaultEffects -import japgolly.scalajs.react.vdom.VdomNode +import japgolly.scalajs.react.vdom.{TopNode, VdomNode} import scala.annotation._ import scala.language.`3.1` import scala.quoted.* @@ -141,7 +141,7 @@ object HookMacros { // TODO: Move into microlibs extension (self: q.reflect.TypeTree) { - def asTypeOf[A]: Tpe[A] = + def asTypeOf[A <: AnyKind]: Tpe[A] = self.asType.asInstanceOf[Tpe[A]] } @@ -289,6 +289,12 @@ object HookMacros { override protected def hooksVar[A] = implicit (tpe, body) => '{ Hooks.Var[$tpe]($body) } + override protected def jsComponentRawMountedType[P <: js.Object, S <: js.Object] = implicit (tpeP, tpeS) => + Tpe.of[JsComponent.RawMounted[P, S]] + + override protected def jsComponentRawMountedTypeWithFacade[P <: js.Object, S <: js.Object, F] = implicit (tpeP, tpeS, tpeF) => + Tpe.of[JsComponent.RawMounted[P, S] with F] + override protected def none[A] = implicit tpe => '{ None } @@ -296,6 +302,34 @@ object HookMacros { case '[a] => Tpe.of[Option[a]].asInstanceOf[Type[Option[A]]] } + override protected def refFromJs[A] = implicit (ref, tpe) => + '{ ScalaRef.fromJs($ref) } + + override protected def refMapJsMounted[P <: js.Object, S <: js.Object] = implicit (ref, tpeP, tpeS) => + '{ $ref.map(JsComponent.mounted(_)) } + + override protected def refMapJsMountedWithFacade[P <: js.Object, S <: js.Object, F <: js.Object] = implicit (ref, tpeP, tpeS, tpeF) => + '{ $ref.map(JsComponent.mounted[P, S](_).addFacade[F]) } + + override protected def refMapMountedImpure[P, S, B] = implicit (ref, tpeS, tpeP, tpeB) => + '{ $ref.map(_.mountedImpure) } + + override protected def refWithJsComponentArgHelper[F[_], A[_], P1, S1, CT1[-p, +u] <: CtorType[p, u], R <: JsComponent.RawMounted[P0, S0], P0 <: js.Object, S0 <: js.Object, CT0[-p, +u] <: CtorType[p, u]] = + implicit (r, a, ttF, ttA, tpeP1, tpeS1, ttCT1, tpeR, tpeP0, tpeS0) => { + implicit val tpeF = ttF.asTypeOf[F] + implicit val tpeA = ttA.asTypeOf[A] + implicit val tpeC = ttCT1.asTypeOf[CT1] + '{ AbstractHookMacros.helperRefToJsComponent($r, $a) } + } + + override protected def refNarrowOption[A, B <: A] = implicit (ref, ct, tpeA, tpeB) => + '{ $ref.narrowOption[$tpeB]($ct) } + + override protected def refToComponentInject[P, S, B, CT[-p, +u] <: CtorType[p, u]] = implicit (c, r, tpeS, tpeP, tpeB, ttCT) => { + implicit val tpeCT = ttCT.asTypeOf[CT] + '{ AbstractHookMacros.helperRefToComponentInject($c, $r) } + } + override protected def reusableDepsLogic[D] = implicit (d, s, r, tpeD) => '{ CustomHook.reusableDepsLogic[D]($d)($s)($r) } @@ -312,6 +346,12 @@ object HookMacros { override protected def reusableValueByInt[A] = implicit (i, a, tpeA) => '{ Reusable.implicitly($i).withValue($a) } + override protected def topNodeType = + Tpe.of[TopNode] + + override protected def scalaComponentRawMountedType[P, S, B] = implicit (tpeS, tpeP, tpeB) => + Tpe.of[ScalaComponent.RawMounted[P, S, B]] + override protected def scalaFn0[A] = implicit (tpe, body) => '{ () => $body } @@ -357,6 +397,15 @@ object HookMacros { override protected def useReducerFromJs[S, A] = implicit (raw, tpeS, tpeA) => '{ Hooks.UseReducer.fromJs($raw) } + override protected def useRef[A] = implicit (a, tpe) => + '{ React.useRef($a) } + + override protected def useRefOrNull[A] = implicit (tpe) => + '{ React.useRef[$tpe | Null](null) } + + override protected def useRefFromJs[A] = implicit (ref, tpe) => + '{ Hooks.UseRef.fromJs($ref) } + override protected def useStateFn[S] = implicit (tpe, body) => '{ React.useStateFn(() => Box[$tpe]($body)) } diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala index a0ddb460b..f1b279d56 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala @@ -1,17 +1,19 @@ package japgolly.scalajs.react.hooks import japgolly.scalajs.react.React.Context +import japgolly.scalajs.react.component.{Js => JsComponent, Scala => ScalaComponent} import japgolly.scalajs.react.facade.React import japgolly.scalajs.react.facade.React.HookDeps import japgolly.scalajs.react.hooks.CustomHook.ReusableDepState import japgolly.scalajs.react.hooks.Hooks import japgolly.scalajs.react.internal.{Box, MacroLogger} import japgolly.scalajs.react.util.DefaultEffects -import japgolly.scalajs.react.vdom.VdomNode -import japgolly.scalajs.react.{Reusability, Reusable} +import japgolly.scalajs.react.vdom.{TopNode, VdomNode} +import japgolly.scalajs.react.{CtorType, Ref, Reusability, Reusable} import scala.annotation.{nowarn, tailrec} import scala.reflect.ClassTag import scala.scalajs.js +import scala.scalajs.js.| /* Coverage * ======== @@ -52,6 +54,15 @@ object AbstractHookMacros { def sig = (targs, args) } + @inline def helperRefToComponentInject[P, S, B, CT[-p, +u] <: CtorType[p, u]](c: ScalaComponent.Component[P, S, B, CT], r: Ref.ToScalaComponent[P, S, B]): Ref.WithScalaComponent[P, S, B, CT] = + Ref.ToComponent.inject(c, r) + + def helperRefToJsComponent[F[_], A[_], P1, S1, CT1[-p, +u] <: CtorType[p, u], R <: JsComponent.RawMounted[P0, S0], P0 <: js.Object, S0 <: js.Object, CT0[-p, +u] <: CtorType[p, u]]( + ref: Ref.Simple[JsComponent.RawMounted[P0, S0] with R], + arg: Ref.WithJsComponentArg[F, A, P1, S1, CT1, R, P0, S0] + ): Ref.WithJsComponent[F, A, P1, S1, CT1, R, P0, S0] = + arg.wrap(ref.map(JsComponent.mounted[P0, S0](_).addFacade[R])) + // =================================================================================================================== // Hook Rewriter @@ -352,8 +363,13 @@ trait AbstractHookMacros { Right(use(_, identity)) import AutoTypeImplicits._ + type F[A] = List[A] trait X trait Y + trait Z + type JX = js.Object with X + type JY = js.Object with Y + type JZ = js.Object with Z def createUseCallbackHook[C](b: Rewriter, ucArg: Term, callback: Expr[C], hookDeps: Expr[HookDeps], tpeC: Type[C]): Ref = { val a = refToTerm(b.valDef(ucArg, "_arg")) // stablise for dependent types @@ -384,9 +400,18 @@ trait AbstractHookMacros { reusableValueByInt[A](rev, value, tpeA) } + // This is `def unsafeCreateSimple[A](): Ref.Simple[A]` in `Hooks` + def simpleRef[A](b: Rewriter, tpe: Type[A]): Expr[Ref.Simple[A]] = { + val raw = b.createRaw(useRefOrNull[A](tpe)) + refFromJs(raw, tpe) + } + implicit def autoSomeRefs(r: Ref): Option[Ref] = Some(r) + def fail = + Left(() => s"Inlining of hook method '${step.name}' not yet supported.") + step.name match { // val (List(), List(List())) = step.sig : @nowarn @@ -530,6 +555,84 @@ trait AbstractHookMacros { b.createHook(useReducerFromJs[X, Y](raw, tpeS, tpeA)) } + case "useRef" | "useRefBy" => + val (List(tpe), List(List(valueFn), List(_))) = step.sig : @nowarn + maybeBy(valueFn) { (b, withCtx) => + val value = withCtx(valueFn) + val raw = b.createRaw(useRef[X](value, tpe)) + b.createHook(useRefFromJs[X](raw, tpe)) + } + + case "useRefToAnyVdom" => + Right { b => + b.createHook(simpleRef[TopNode](b, topNodeType)) + } + + case "useRefToJsComponent" => + step.sig match { + case (List(tpeP, tpeS), List(_)) => + type P = JX + type S = JY + Right { b => + val tpeM = jsComponentRawMountedType[P, S](tpeP, tpeS) + val ref = simpleRef[JsComponent.RawMounted[P, S]](b, tpeM) + b.createHook(refMapJsMounted[P, S](ref, tpeP, tpeS)) + } + + case (List(tpeF, tpeA, tpeP1, tpeS1, tpeCT1, tpeR, tpeP0, tpeS0), List(List(arg), List(_))) => + type P = JX + type S = JY + type R = js.Object with JsComponent.RawMounted[P, S] + Right { b => + val tpeM = jsComponentRawMountedTypeWithFacade[P, S, R](tpeP0, tpeS0, tpeR) + val ref = simpleRef[JsComponent.RawMounted[P, S] with R](b, tpeM) + val hook = refWithJsComponentArgHelper[F, F, P, S, CtorType, R, P, S, CtorType](ref, arg, tpeF, tpeA, tpeP1, tpeS1, tpeCT1, tpeR, tpeP0, tpeS0) + b.createHook(hook) + } + + case _ => fail + } + + case "useRefToJsComponentWithMountedFacade" => + val (List(tpeP, tpeS, tpeF), List(List(_))) = step.sig : @nowarn + type P = JX + type S = JY + type F = JZ + Right { b => + val tpeM = jsComponentRawMountedTypeWithFacade[P, S, F](tpeP, tpeS, tpeF) + val ref = simpleRef[JsComponent.RawMounted[P, S] with F](b, tpeM) + val hook = refMapJsMountedWithFacade[P, S, F](ref, tpeP, tpeS, tpeF) + b.createHook(hook) + } + + case "useRefToScalaComponent" => + def build[P, S, B](b: Rewriter, tpeP: Type[P], tpeS: Type[S], tpeB: Type[B]) = { + val tpeM = scalaComponentRawMountedType[P, S, B](tpeP, tpeS, tpeB) + val ref = simpleRef[ScalaComponent.RawMounted[P, S, B]](b, tpeM) + refMapMountedImpure(ref, tpeP, tpeS, tpeB) + } + step.sig match { + case (List(tpeP, tpeS, tpeB), List(List(_))) => + Right { b => + b.createHook(build[X, Y, Z](b, tpeP, tpeS, tpeB)) + } + + case (List(tpeP, tpeS, tpeB, tpeCT), List(List(comp), List(_))) => + Right { b => + val ref = build[X, Y, Z](b, tpeP, tpeS, tpeB) + b.createHook(refToComponentInject[X, Y, Z, CtorType](comp, ref, tpeP, tpeS, tpeB, tpeCT)) + } + + case _ => fail + } + + case "useRefToVdom" => + val (List(tpe), List(List(ct, _))) = step.sig : @nowarn + Right { b => + val sup = simpleRef[TopNode](b, topNodeType) + b.createHook(refNarrowOption[TopNode, TopNode](sup, ct, topNodeType, tpe)) + } + case "useState" | "useStateBy" => val (List(tpe), List(List(initialStateFn), List(_))) = step.sig : @nowarn maybeBy(initialStateFn) { (b, withCtx) => @@ -545,7 +648,7 @@ trait AbstractHookMacros { } case _ => - Left(() => s"Inlining of hook method '${step.name}' not yet supported.") + fail } } @@ -562,10 +665,31 @@ trait AbstractHookMacros { protected def hooksVar[A]: (Type[A], Expr[A]) => Expr[Hooks.Var[A]] + protected def jsComponentRawMountedType[P <: js.Object, S <: js.Object]: (Type[P], Type[S]) => Type[JsComponent.RawMounted[P, S]] + + protected def jsComponentRawMountedTypeWithFacade[P <: js.Object, S <: js.Object, F]: (Type[P], Type[S], Type[F]) => Type[JsComponent.RawMounted[P, S] with F] + protected def none[A]: Type[Option[A]] => Expr[Option[A]] protected def optionType[A]: Type[A] => Type[Option[A]] + protected def refFromJs[A]: (Expr[React.RefHandle[A | Null]], Type[A]) => Expr[Ref.Simple[A]] + + protected def refMapJsMounted[P <: js.Object, S <: js.Object]: (Expr[Ref.Simple[JsComponent.RawMounted[P, S]]], Type[P], Type[S]) => Expr[Ref.ToJsComponent[P, S, JsComponent.RawMounted[P, S]]] + + protected def refMapJsMountedWithFacade[P <: js.Object, S <: js.Object, F <: js.Object]: (Expr[Ref.Simple[JsComponent.RawMounted[P, S] with F]], Type[P], Type[S], Type[F]) => Expr[Ref.ToJsComponent[P, S, JsComponent.RawMounted[P, S] with F]] + + protected def refMapMountedImpure[P, S, B]: (Expr[Ref.Simple[ScalaComponent.RawMounted[P, S, B]]], Type[P], Type[S], Type[B]) => Expr[Ref.ToScalaComponent[P, S, B]] + + protected def refWithJsComponentArgHelper[F[_], A[_], P1, S1, CT1[-p, +u] <: CtorType[p, u], R <: JsComponent.RawMounted[P0, S0], P0 <: js.Object, S0 <: js.Object, CT0[-p, +u] <: CtorType[p, u]]: + (Expr[Ref.Simple[JsComponent.RawMounted[P0, S0] with R]], Expr[Ref.WithJsComponentArg[F, A, P1, S1, CT1, R, P0, S0]], + TypeTree, TypeTree, Type[P1], Type[S1], TypeTree, Type[R], Type[P0], Type[S0] + ) => Expr[Ref.WithJsComponent[F, A, P1, S1, CT1, R, P0, S0]] + + protected def refNarrowOption[A, B <: A]: (Expr[Ref.Simple[A]], Expr[ClassTag[B]], Type[A], Type[B]) => Expr[Ref.Full[A, A, B]] + + protected def refToComponentInject[P, S, B, CT[-p, +u] <: CtorType[p, u]]: (Expr[ScalaComponent.Component[P, S, B, CT]], Expr[Ref.ToScalaComponent[P, S, B]], Type[P], Type[S], Type[B], TypeTree) => Expr[Ref.WithScalaComponent[P, S, B, CT]] + protected def reusableDepsLogic[D]: (Expr[D], Expr[Hooks.UseState[Option[ReusableDepState[D]]]], Expr[Reusability[D]], Type[D]) => Expr[ReusableDepState[D]] protected def reusableDepStateRev: Expr[ReusableDepState[Any]] => Expr[Int] @@ -576,6 +700,10 @@ trait AbstractHookMacros { protected def reusableValueByInt[A]: (Expr[Int], Expr[A], Type[A]) => Expr[Reusable[A]] + protected def topNodeType: Type[TopNode] + + protected def scalaComponentRawMountedType[P, S, B]: (Type[P], Type[S], Type[B]) => Type[ScalaComponent.RawMounted[P, S, B]] + protected def scalaFn0[A]: (Type[A], Expr[A]) => Expr[() => A] protected def useCallback[F <: js.Function]: (Expr[F], Expr[HookDeps], Type[F]) => Expr[F] @@ -606,6 +734,12 @@ trait AbstractHookMacros { protected def useReducerFromJs[S, A]: (Expr[React.UseReducer[S, A]], Type[S], Type[A]) => Expr[Hooks.UseReducer[S, A]] + protected def useRef[A]: (Expr[A], Type[A]) => Expr[React.RefHandle[A]] + + protected def useRefOrNull[A]: Type[A] => Expr[React.RefHandle[A | Null]] + + protected def useRefFromJs[A]: (Expr[React.RefHandle[A]], Type[A]) => Expr[Hooks.UseRef[A]] + protected def useStateFn[S]: (Type[S], Expr[S]) => Expr[React.UseState[Box[S]]] protected def useStateValue[S]: (Type[S], Expr[S]) => Expr[React.UseState[Box[S]]] diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Api.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Api.scala index 3dee236d1..9c8827261 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Api.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Api.scala @@ -421,7 +421,7 @@ object Api { next(_ => UseRef.unsafeCreateToJsComponentWithMountedFacade[P, S, F]()) /** Create a mutable ref that will persist for the full lifetime of the component. */ - final def useRefToJsComponent[F[_], A[_], P1, S1, CT1[-p, +u] <: CtorType[p, u], R <: JsComponent.RawMounted[P0, S0], P0 <: js.Object, S0 <: js.Object, CT0[-p, +u] <: CtorType[p, u]] + final def useRefToJsComponent[F[_], A[_], P1, S1, CT1[-p, +u] <: CtorType[p, u], R <: JsComponent.RawMounted[P0, S0], P0 <: js.Object, S0 <: js.Object] (a: Ref.WithJsComponentArg[F, A, P1, S1, CT1, R, P0, S0])(implicit step: Step) : step.Next[Ref.WithJsComponent[F, A, P1, S1, CT1, R, P0, S0]] = next(_ => UseRef.unsafeCreateToJsComponent(a)) @@ -650,8 +650,8 @@ object Api { useReducerBy(step.squash(reducer)(_), step.squash(initialState)(_)) /** Create a mutable ref that will persist for the full lifetime of the component. */ - final def useRefBy[A](f: CtxFn[A])(implicit step: Step): step.Next[UseRef[A]] = - useRefBy(step.squash(f)(_)) + final def useRefBy[A](initialValue: CtxFn[A])(implicit step: Step): step.Next[UseRef[A]] = + useRefBy(step.squash(initialValue)(_)) /** Returns a stateful value, and a function to update it. * diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/CustomHook.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/CustomHook.scala index 14a958e65..735ec5f6d 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/CustomHook.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/CustomHook.scala @@ -1,11 +1,10 @@ package japgolly.scalajs.react.hooks import japgolly.microlibs.types.NaturalComposition -import japgolly.scalajs.react.facade import japgolly.scalajs.react.internal.ShouldComponentUpdateComponent import japgolly.scalajs.react.util.DefaultEffects import japgolly.scalajs.react.vdom.VdomNode -import japgolly.scalajs.react.{PropsChildren, Reusability, Reusable} +import japgolly.scalajs.react.{PropsChildren, Reusability, Reusable, facade} import scala.scalajs.js final class CustomHook[I, O] private[CustomHook] (val unsafeInit: I => O) extends AnyVal { diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Hooks.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Hooks.scala index 6cd6a2d0e..48fea15d4 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Hooks.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/Hooks.scala @@ -208,8 +208,11 @@ object Hooks { type UseRef[A] = UseRefF[D.Sync, A] object UseRef { + def fromJs[A](ref: facade.React.RefHandle[A]): UseRef[A] = + new UseRefF(ref)(D.Sync) + def unsafeCreate[A](initialValue: A): UseRef[A] = - new UseRefF(facade.React.useRef(initialValue))(D.Sync) + fromJs(facade.React.useRef(initialValue)) def unsafeCreateSimple[A](): Ref.Simple[A] = Ref.fromJs(facade.React.useRef[A | Null](null)) diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala index f8788e47b..822cef1bd 100644 --- a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala @@ -26,6 +26,7 @@ object Main { UseCallback .Component(0), UseEffect .Component(0), UseMemo .Component(0), + UseRef .Component(0), UseStateWithReuse .Component(0), ) } diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseRef.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseRef.scala new file mode 100644 index 000000000..99a7d1642 --- /dev/null +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/UseRef.scala @@ -0,0 +1,32 @@ +package japgolly.scalajs.react.test.emissions + +import japgolly.scalajs.react._ +import japgolly.scalajs.react.vdom.html_<^._ +import org.scalajs.dom.html.Input +import scala.scalajs.js + +object UseRef { + + trait JsP extends js.Object + trait JsS extends js.Object + trait JsF extends js.Object + + val jsComp = JsComponent.force[Null, Children.None, Null](null) + + val scalaComp = ScalaComponent.builder[Int].render_P(identity).build + + val Component = ScalaFnComponent.withHooks[Int] + + .useRef(100) + .useRefBy((p, _) => p) + .useRefBy(_.props) + .useRefToVdom[Input] + .useRefToAnyVdom + .useRefToJsComponent(jsComp) + .useRefToJsComponent[JsP, JsS] + .useRefToJsComponentWithMountedFacade[JsP, JsS, JsF] + .useRefToScalaComponent(scalaComp) + .useRefToScalaComponent[Int, Long, String] + + .renderRR { _ => 123 } +} diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseRef-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseRef-out2.js new file mode 100644 index 000000000..3960a5758 --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseRef-out2.js @@ -0,0 +1,138 @@ +'use strict'; + +var _s = $RefreshSig$(); + +import * as $i_react from "react"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eRef$0024 from "./japgolly.scalajs.react.Ref$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eRef$0024FullF from "./japgolly.scalajs.react.Ref$FullF.js"; +import * as $j_japgolly$002escalajs$002ereact$002eRef$0024ToComponent$0024 from "./japgolly.scalajs.react.Ref$ToComponent$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eRef$0024WithJsComponentArg$0024 from "./japgolly.scalajs.react.Ref$WithJsComponentArg$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJs$0024$0024anon$00243 from "./japgolly.scalajs.react.component.Js$$anon$3.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScala$0024MountedWithRoot from "./japgolly.scalajs.react.component.Scala$MountedWithRoot.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002ebuilder$002eComponentBuilder$0024Step1 from "./japgolly.scalajs.react.component.builder.ComponentBuilder$Step1.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002ebuilder$002eComponentBuilder$0024Step2 from "./japgolly.scalajs.react.component.builder.ComponentBuilder$Step2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002ebuilder$002eInitState$0024Stateless$0024 from "./japgolly.scalajs.react.component.builder.InitState$Stateless$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eAbstractHookMacros$0024 from "./japgolly.scalajs.react.hooks.AbstractHookMacros$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseRefF from "./japgolly.scalajs.react.hooks.Hooks$UseRefF.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 from "./japgolly.scalajs.react.internal.Singleton$.js"; +import * as $j_japgolly$002escalajs$002ereact$002epackage$0024 from "./japgolly.scalajs.react.package$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024 from "./japgolly.scalajs.react.util.DefaultEffects$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_org$002escalajs$002edom$002eHTMLInputElement from "./org.scalajs.dom.HTMLInputElement.js"; +import * as $j_scala$002eFunction1 from "./scala.Function1.js"; + +function $c_Ljapgolly_scalajs_react_test_emissions_UseRef$() { + this.Ljapgolly_scalajs_react_test_emissions_UseRef$__f_jsComp = null; + this.Ljapgolly_scalajs_react_test_emissions_UseRef$__f_scalaComp = null; + this.Ljapgolly_scalajs_react_test_emissions_UseRef$__f_Component = null; + $n_Ljapgolly_scalajs_react_test_emissions_UseRef$ = this; + this.Ljapgolly_scalajs_react_test_emissions_UseRef$__f_jsComp = $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_JsComponent.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(null, $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonN__Ljapgolly_scalajs_react_internal_Singleton__Ljapgolly_scalajs_react_CtorType$Summoner($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$().Ljapgolly_scalajs_react_internal_Singleton$__f_Null)); + var b = new $j_japgolly$002escalajs$002ereact$002ecomponent$002ebuilder$002eComponentBuilder$0024Step1.$c_Ljapgolly_scalajs_react_component_builder_ComponentBuilder$Step1("japgolly.scalajs.react.test.emissions.UseRef"); + var b$1 = b.Ljapgolly_scalajs_react_component_builder_ComponentBuilder$Step1__f_japgolly$scalajs$react$component$builder$ComponentBuilder$Step1$$name; + this.Ljapgolly_scalajs_react_test_emissions_UseRef$__f_scalaComp = new $j_japgolly$002escalajs$002ereact$002ecomponent$002ebuilder$002eComponentBuilder$0024Step2.$c_Ljapgolly_scalajs_react_component_builder_ComponentBuilder$Step2(b$1, $j_japgolly$002escalajs$002ereact$002ecomponent$002ebuilder$002eInitState$0024Stateless$0024.$m_Ljapgolly_scalajs_react_component_builder_InitState$Stateless$()).noBackend__Ljapgolly_scalajs_react_component_builder_ComponentBuilder$Step3().render_P__F1__Ljapgolly_scalajs_react_component_builder_ComponentBuilder$LastStep(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$2 => { + var x = x$2 | 0; + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + return new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(x); + })).build__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot($j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$(), null))); + + var rawComponent = arg1$2 => $m_Ljapgolly_scalajs_react_test_emissions_UseRef$().japgolly$scalajs$react$test$emissions$UseRef$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2); + + var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$8 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$(), null)); + this.Ljapgolly_scalajs_react_test_emissions_UseRef$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$8.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_UseRef$ }; +$c_Ljapgolly_scalajs_react_test_emissions_UseRef$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_UseRef$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_UseRef$; + +function $h_Ljapgolly_scalajs_react_test_emissions_UseRef$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_UseRef$ }; +$h_Ljapgolly_scalajs_react_test_emissions_UseRef$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_UseRef$.prototype; +$c_Ljapgolly_scalajs_react_test_emissions_UseRef$.prototype.japgolly$scalajs$react$test$emissions$UseRef$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s(function (props) { + _s(); + + var __japgolly__hook1_raw = $i_react.useRef(100); + + var this$2 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); + new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseRefF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseRefF(__japgolly__hook1_raw, this$2.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + + var __japgolly__hook2_raw = $i_react.useRef(props.a); + + var this$4 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); + new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseRefF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseRefF(__japgolly__hook2_raw, this$4.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + var props$1 = props.a; + + var __japgolly__hook3_raw = $i_react.useRef(props$1); + + var this$7 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); + new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseRefF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseRefF(__japgolly__hook3_raw, this$7.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + + var __japgolly__hook4_raw = $i_react.useRef(null); + + var this$9 = $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook4_raw); + var ct = new $j_java$002elang$002eCharacter$0024.$c_s_reflect_ClassTag$GenericClassTag($j_org$002escalajs$002edom$002eHTMLInputElement.$d_Lorg_scalajs_dom_HTMLInputElement.getClassOf()); + $j_japgolly$002escalajs$002ereact$002eRef$0024FullF.$f_Ljapgolly_scalajs_react_Ref$FullF__narrowOption__s_reflect_ClassTag__Ljapgolly_scalajs_react_Ref$FullF(this$9, ct); + + var __japgolly__hook5_raw = $i_react.useRef(null); + + $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook5_raw); + + var __japgolly__hook6_raw = $i_react.useRef(null); + + $j_japgolly$002escalajs$002ereact$002ehooks$002eAbstractHookMacros$0024.$m_Ljapgolly_scalajs_react_hooks_AbstractHookMacros$().helperRefToJsComponent__Ljapgolly_scalajs_react_Ref$FullF__F1__Ljapgolly_scalajs_react_Ref$ToComponentF($j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook6_raw), $j_japgolly$002escalajs$002ereact$002eRef$0024WithJsComponentArg$0024.$m_Ljapgolly_scalajs_react_Ref$WithJsComponentArg$().effectId__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__F1($m_Ljapgolly_scalajs_react_test_emissions_UseRef$().Ljapgolly_scalajs_react_test_emissions_UseRef$__f_jsComp)); + + var __japgolly__hook7_raw = $i_react.useRef(null); + + $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook7_raw).map__F1__Ljapgolly_scalajs_react_Ref$FullF(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$1$2 => new $j_japgolly$002escalajs$002ereact$002ecomponent$002eJs$0024$0024anon$00243.$c_Ljapgolly_scalajs_react_component_Js$$anon$3(x$1$2))); + + var __japgolly__hook8_raw = $i_react.useRef(null); + + $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook8_raw).map__F1__Ljapgolly_scalajs_react_Ref$FullF(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$2$2 => { + $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$(); + var this$13 = new $j_japgolly$002escalajs$002ereact$002ecomponent$002eJs$0024$0024anon$00243.$c_Ljapgolly_scalajs_react_component_Js$$anon$3(x$2$2); + return this$13; + })); + + var __japgolly__hook9_raw = $i_react.useRef(null); + + var c = $m_Ljapgolly_scalajs_react_test_emissions_UseRef$().Ljapgolly_scalajs_react_test_emissions_UseRef$__f_scalaComp; + var r = $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook9_raw).map__F1__Ljapgolly_scalajs_react_Ref$FullF(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$3$2 => x$3$2.mountedImpure)); + $j_japgolly$002escalajs$002ereact$002eRef$0024ToComponent$0024.$m_Ljapgolly_scalajs_react_Ref$ToComponent$().inject__Ljapgolly_scalajs_react_CtorType__Ljapgolly_scalajs_react_Ref$FullF__Ljapgolly_scalajs_react_Ref$ToComponentF(c.ctor__Ljapgolly_scalajs_react_CtorType(), r); + + var __japgolly__hook10_raw = $i_react.useRef(null); + + $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook10_raw).map__F1__Ljapgolly_scalajs_react_Ref$FullF(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$4$2 => x$4$2.mountedImpure)); + props.a; + return ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(123)).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; +}, "4YAVp10giPdDWy5crWN+hQ8h7yo="); +var $d_Ljapgolly_scalajs_react_test_emissions_UseRef$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_UseRef$: 0 +}, false, "japgolly.scalajs.react.test.emissions.UseRef$", { + Ljapgolly_scalajs_react_test_emissions_UseRef$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_UseRef$ }; +$c_Ljapgolly_scalajs_react_test_emissions_UseRef$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_UseRef$; +var $n_Ljapgolly_scalajs_react_test_emissions_UseRef$; + +function $m_Ljapgolly_scalajs_react_test_emissions_UseRef$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_UseRef$) { + $n_Ljapgolly_scalajs_react_test_emissions_UseRef$ = new $c_Ljapgolly_scalajs_react_test_emissions_UseRef$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_UseRef$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_UseRef$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseRef-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseRef-out3.js new file mode 100644 index 000000000..7799ce790 --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseRef-out3.js @@ -0,0 +1,198 @@ +'use strict'; + +import * as $i_react from "react"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eRef$0024 from "./japgolly.scalajs.react.Ref$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eRef$0024FullF from "./japgolly.scalajs.react.Ref$FullF.js"; +import * as $j_japgolly$002escalajs$002ereact$002eRef$0024ToComponent$0024 from "./japgolly.scalajs.react.Ref$ToComponent$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eRef$0024WithJsComponentArg$0024 from "./japgolly.scalajs.react.Ref$WithJsComponentArg$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJs$0024$0024anon$00243 from "./japgolly.scalajs.react.component.Js$$anon$3.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScala$0024MountedWithRoot from "./japgolly.scalajs.react.component.Scala$MountedWithRoot.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002ebuilder$002eComponentBuilder$0024Step1 from "./japgolly.scalajs.react.component.builder.ComponentBuilder$Step1.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002ebuilder$002eComponentBuilder$0024Step2 from "./japgolly.scalajs.react.component.builder.ComponentBuilder$Step2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002ebuilder$002eComponentBuilder$0024Step3 from "./japgolly.scalajs.react.component.builder.ComponentBuilder$Step3.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002ebuilder$002eInitState$0024Stateless$0024 from "./japgolly.scalajs.react.component.builder.InitState$Stateless$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eAbstractHookMacros$0024 from "./japgolly.scalajs.react.hooks.AbstractHookMacros$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseRefF from "./japgolly.scalajs.react.hooks.Hooks$UseRefF.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 from "./japgolly.scalajs.react.internal.Singleton$.js"; +import * as $j_japgolly$002escalajs$002ereact$002epackage$0024 from "./japgolly.scalajs.react.package$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024 from "./japgolly.scalajs.react.util.DefaultEffects$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_org$002escalajs$002edom$002eHTMLInputElement from "./org.scalajs.dom.HTMLInputElement.js"; +import * as $j_scala$002eConversion from "./scala.Conversion.js"; +import * as $j_scala$002eFunction1 from "./scala.Function1.js"; + +function $c_Ljapgolly_scalajs_react_test_emissions_UseRef$() { + this.Ljapgolly_scalajs_react_test_emissions_UseRef$__f_jsComp = null; + this.Ljapgolly_scalajs_react_test_emissions_UseRef$__f_scalaComp = null; + this.Ljapgolly_scalajs_react_test_emissions_UseRef$__f_Component = null; + $n_Ljapgolly_scalajs_react_test_emissions_UseRef$ = this; + this.Ljapgolly_scalajs_react_test_emissions_UseRef$__f_jsComp = $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_JsComponent.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(null, $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonN__Ljapgolly_scalajs_react_internal_Singleton__Ljapgolly_scalajs_react_CtorType$Summoner($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$().Ljapgolly_scalajs_react_internal_Singleton$__f_Null)); + this.Ljapgolly_scalajs_react_test_emissions_UseRef$__f_scalaComp = new $c_Ljapgolly_scalajs_react_test_emissions_UseRef$$anon$2().apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecomponent$002ebuilder$002eComponentBuilder$0024Step1.$c_Ljapgolly_scalajs_react_component_builder_ComponentBuilder$Step1("japgolly.scalajs.react.test.emissions.UseRef")).render_P__F1__Ljapgolly_scalajs_react_component_builder_ComponentBuilder$LastStep(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x => { + var x$1 = x | 0; + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + var x$2 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(x$1); + return x$2; + })).build__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot($j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null)); + + var rawComponent = (this$2$1 => { + var _s = $RefreshSig$(); + + return _s(props => { + _s(); + + var __japgolly__hook1_raw = $i_react.useRef(100); + + var this$6 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); + new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseRefF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseRefF(__japgolly__hook1_raw, this$6.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + var $$x1 = $i_react; + var p = props.a | 0; + + var __japgolly__hook2_raw = $$x1.useRef(p); + + var this$8 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); + new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseRefF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseRefF(__japgolly__hook2_raw, this$8.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + var props$1 = props.a; + + var __japgolly__hook3_raw = $i_react.useRef(props$1); + + var this$11 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); + new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseRefF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseRefF(__japgolly__hook3_raw, this$11.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + + var __japgolly__hook4_raw = $i_react.useRef(null); + + var this$13 = $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook4_raw); + var ct = new $j_java$002elang$002eCharacter$0024.$c_s_reflect_ClassTag$GenericClassTag($j_org$002escalajs$002edom$002eHTMLInputElement.$d_Lorg_scalajs_dom_HTMLInputElement.getClassOf()); + $j_japgolly$002escalajs$002ereact$002eRef$0024FullF.$f_Ljapgolly_scalajs_react_Ref$FullF__narrowOption__s_reflect_ClassTag__Ljapgolly_scalajs_react_Ref$FullF(this$13, ct); + + var __japgolly__hook5_raw = $i_react.useRef(null); + + $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook5_raw); + + var __japgolly__hook6_raw = $i_react.useRef(null); + + $j_japgolly$002escalajs$002ereact$002ehooks$002eAbstractHookMacros$0024.$m_Ljapgolly_scalajs_react_hooks_AbstractHookMacros$().helperRefToJsComponent__Ljapgolly_scalajs_react_Ref$FullF__F1__Ljapgolly_scalajs_react_Ref$ToComponentF($j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook6_raw), $j_japgolly$002escalajs$002ereact$002eRef$0024WithJsComponentArg$0024.$m_Ljapgolly_scalajs_react_Ref$WithJsComponentArg$().effectId__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__F1(this$2$1.Ljapgolly_scalajs_react_test_emissions_UseRef$__f_jsComp)); + + var __japgolly__hook7_raw = $i_react.useRef(null); + + $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook7_raw).map__F1__Ljapgolly_scalajs_react_Ref$FullF(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$20 => new $j_japgolly$002escalajs$002ereact$002ecomponent$002eJs$0024$0024anon$00243.$c_Ljapgolly_scalajs_react_component_Js$$anon$3(_$20))); + + var __japgolly__hook8_raw = $i_react.useRef(null); + + $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook8_raw).map__F1__Ljapgolly_scalajs_react_Ref$FullF(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$21 => { + var this$17 = new $j_japgolly$002escalajs$002ereact$002ecomponent$002eJs$0024$0024anon$00243.$c_Ljapgolly_scalajs_react_component_Js$$anon$3(_$21); + return this$17; + })); + + var __japgolly__hook9_raw = $i_react.useRef(null); + + var c = this$2$1.Ljapgolly_scalajs_react_test_emissions_UseRef$__f_scalaComp; + var r = $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook9_raw).map__F1__Ljapgolly_scalajs_react_Ref$FullF(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$22 => _$22.mountedImpure)); + $j_japgolly$002escalajs$002ereact$002eRef$0024ToComponent$0024.$m_Ljapgolly_scalajs_react_Ref$ToComponent$().inject__Ljapgolly_scalajs_react_CtorType__Ljapgolly_scalajs_react_Ref$FullF__Ljapgolly_scalajs_react_Ref$ToComponentF(c.ctor__Ljapgolly_scalajs_react_CtorType(), r); + + var __japgolly__hook10_raw = $i_react.useRef(null); + + $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook10_raw).map__F1__Ljapgolly_scalajs_react_Ref$FullF(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$22$2 => _$22$2.mountedImpure)); + props.a; + return ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(123)).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; + }, "4YAVp10giPdDWy5crWN+hQ8h7yo="); + })(this); + + var $$x2 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$23 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); + this.Ljapgolly_scalajs_react_test_emissions_UseRef$__f_Component = $$x2.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$23.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_UseRef$ }; +$c_Ljapgolly_scalajs_react_test_emissions_UseRef$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_UseRef$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_UseRef$; + +function $h_Ljapgolly_scalajs_react_test_emissions_UseRef$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_UseRef$ }; +$h_Ljapgolly_scalajs_react_test_emissions_UseRef$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_UseRef$.prototype; +var $d_Ljapgolly_scalajs_react_test_emissions_UseRef$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_UseRef$: 0 +}, false, "japgolly.scalajs.react.test.emissions.UseRef$", { + Ljapgolly_scalajs_react_test_emissions_UseRef$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_UseRef$ }; +$c_Ljapgolly_scalajs_react_test_emissions_UseRef$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_UseRef$; +var $n_Ljapgolly_scalajs_react_test_emissions_UseRef$; + +function $m_Ljapgolly_scalajs_react_test_emissions_UseRef$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_UseRef$) { + $n_Ljapgolly_scalajs_react_test_emissions_UseRef$ = new $c_Ljapgolly_scalajs_react_test_emissions_UseRef$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_UseRef$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_UseRef$ }; + +function $c_Ljapgolly_scalajs_react_test_emissions_UseRef$$anon$1() {} + +export { $c_Ljapgolly_scalajs_react_test_emissions_UseRef$$anon$1 }; +$c_Ljapgolly_scalajs_react_test_emissions_UseRef$$anon$1.prototype = new $j_scala$002eConversion.$h_s_Conversion(); +$c_Ljapgolly_scalajs_react_test_emissions_UseRef$$anon$1.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_UseRef$$anon$1; + +function $h_Ljapgolly_scalajs_react_test_emissions_UseRef$$anon$1() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_UseRef$$anon$1 }; +$h_Ljapgolly_scalajs_react_test_emissions_UseRef$$anon$1.prototype = $c_Ljapgolly_scalajs_react_test_emissions_UseRef$$anon$1.prototype; + +$c_Ljapgolly_scalajs_react_test_emissions_UseRef$$anon$1.prototype.apply__O__O = function (x) { + var _$1 = x === null ? null : x.Ljapgolly_scalajs_react_component_builder_ComponentBuilder$Step1__f_name; + + $m_Ljapgolly_scalajs_react_test_emissions_UseRef$(); + return new $j_japgolly$002escalajs$002ereact$002ecomponent$002ebuilder$002eComponentBuilder$0024Step2.$c_Ljapgolly_scalajs_react_component_builder_ComponentBuilder$Step2(_$1, $j_japgolly$002escalajs$002ereact$002ecomponent$002ebuilder$002eInitState$0024Stateless$0024.$m_Ljapgolly_scalajs_react_component_builder_InitState$Stateless$()); +}; + +var $d_Ljapgolly_scalajs_react_test_emissions_UseRef$$anon$1 = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_UseRef$$anon$1: 0 +}, false, "japgolly.scalajs.react.test.emissions.UseRef$$anon$1", { + Ljapgolly_scalajs_react_test_emissions_UseRef$$anon$1: 1, + s_Conversion: 1, + O: 1, + F1: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_UseRef$$anon$1 }; +$c_Ljapgolly_scalajs_react_test_emissions_UseRef$$anon$1.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_UseRef$$anon$1; + +function $c_Ljapgolly_scalajs_react_test_emissions_UseRef$$anon$2() {} + +export { $c_Ljapgolly_scalajs_react_test_emissions_UseRef$$anon$2 }; +$c_Ljapgolly_scalajs_react_test_emissions_UseRef$$anon$2.prototype = new $j_scala$002eConversion.$h_s_Conversion(); +$c_Ljapgolly_scalajs_react_test_emissions_UseRef$$anon$2.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_UseRef$$anon$2; + +function $h_Ljapgolly_scalajs_react_test_emissions_UseRef$$anon$2() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_UseRef$$anon$2 }; +$h_Ljapgolly_scalajs_react_test_emissions_UseRef$$anon$2.prototype = $c_Ljapgolly_scalajs_react_test_emissions_UseRef$$anon$2.prototype; + +$c_Ljapgolly_scalajs_react_test_emissions_UseRef$$anon$2.prototype.apply__O__O = function (x) { + var x$1 = x === null ? null : x.Ljapgolly_scalajs_react_component_builder_ComponentBuilder$Step1__f_name; + $m_Ljapgolly_scalajs_react_test_emissions_UseRef$(); + return new $c_Ljapgolly_scalajs_react_test_emissions_UseRef$$anon$1().apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecomponent$002ebuilder$002eComponentBuilder$0024Step1.$c_Ljapgolly_scalajs_react_component_builder_ComponentBuilder$Step1(x$1)).noBackend__Ljapgolly_scalajs_react_component_builder_ComponentBuilder$Step3(); +}; + +var $d_Ljapgolly_scalajs_react_test_emissions_UseRef$$anon$2 = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_UseRef$$anon$2: 0 +}, false, "japgolly.scalajs.react.test.emissions.UseRef$$anon$2", { + Ljapgolly_scalajs_react_test_emissions_UseRef$$anon$2: 1, + s_Conversion: 1, + O: 1, + F1: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_UseRef$$anon$2 }; +$c_Ljapgolly_scalajs_react_test_emissions_UseRef$$anon$2.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_UseRef$$anon$2; diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala index c24c8cc3c..7d05a6eee 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala @@ -36,6 +36,7 @@ object ReactRefreshTest extends TestSuite { "UseCallback" - testScala() "UseEffect" - testScala() "UseMemo" - testScala() + "UseRef" - testScala() "UseStateWithReuse" - testScala() } } diff --git a/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksRRTest.scala b/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksRRTest.scala index 53135fac0..9575ec901 100644 --- a/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksRRTest.scala +++ b/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksRRTest.scala @@ -7,11 +7,14 @@ import japgolly.scalajs.react.test.DomTester import japgolly.scalajs.react.test.ReactTestUtils._ import japgolly.scalajs.react.test.TestUtil._ import japgolly.scalajs.react.vdom.html_<^._ +import scala.scalajs.js +import org.scalajs.dom.Node import org.scalajs.dom.html.Input import utest._ -// Copy of HooksTest but using renderRR -// TODO: Remove tests that don't use renderRR +// Based off of HooksTest but +// - uses renderRR +// - includes compilation tests for trivial useRef hooks missing from HooksTest object HooksRRTest extends TestSuite { // TODO: https://github.com/lampepfl/dotty/issues/12663 @@ -1321,6 +1324,37 @@ object HooksRRTest extends TestSuite { test(comp(3))(_ assertText "31 | 123 | yo!") } + // =================================================================================================================== + // Not included in HooksTest + + private trait JsP extends js.Object + private trait JsS extends js.Object + private trait JsF extends js.Object + + private def testUseRefCompilation(): Unit = { + val jsComp = JsComponent.force[Null, Children.None, Null](null) + + ScalaFnComponent.withHooks[Unit] + .useRefToAnyVdom + .useRefToJsComponent(jsComp) + .useRefToJsComponent[JsP, JsS] + .useRefToJsComponentWithMountedFacade[JsP, JsS, JsF] + .useRefToScalaComponent(ReusableCallbackComponent) + .useRefToScalaComponent[Int, Long, String] + .renderRR { (_, any, js, jsPS, jsPSF, scala, scalaPSB) => + + // Assert types of results + any : Ref.Simple[Node] + jsComp.withRef(js)() + jsPS : Ref.ToJsComponent[JsP, JsS, JsComponent.RawMounted[JsP, JsS]] + jsPSF : Ref.ToJsComponent[JsP, JsS, JsComponent.RawMounted[JsP, JsS] with JsF] + ReusableCallbackComponent.withRef(scala)(Reusable.never(Callback.empty)) + scalaPSB : Ref.ToScalaComponent[Int, Long, String] + + "ok" + } + } + // =================================================================================================================== override def tests = Tests { @@ -1368,6 +1402,7 @@ object HooksRRTest extends TestSuite { "depsBy" - testUseMemoBy() } "useRef" - { + "compilation" - testUseRefCompilation() "manual" - testUseRefManual() "manualBy" - testUseRefManualBy() "vdom" - testUseRefVdom() From df81d849a5670fb4fd3ff7861b2264fc0f821408 Mon Sep 17 00:00:00 2001 From: David Barri Date: Mon, 27 Jun 2022 10:16:18 +1000 Subject: [PATCH 66/72] Remove obsolete emission test output --- .../test/resources/rr-sjr/UseState-out2.js | 118 ------------------ .../test/resources/rr-sjr/UseState-out3.js | 117 ----------------- 2 files changed, 235 deletions(-) delete mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out2.js delete mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out3.js diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out2.js deleted file mode 100644 index d8c5202ef..000000000 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out2.js +++ /dev/null @@ -1,118 +0,0 @@ -'use strict'; - -var _s = $RefreshSig$(); - -import * as $i_react from "react"; -import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; -import * as $j_japgolly$002escalajs$002ereact$002eReusable$0024 from "./japgolly.scalajs.react.Reusable$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; -import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2 from "./japgolly.scalajs.react.hooks.HookCtx$P2.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF from "./japgolly.scalajs.react.hooks.Hooks$UseStateF.js"; -import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; -import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 from "./japgolly.scalajs.react.internal.Singleton$.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024 from "./japgolly.scalajs.react.vdom.Attr$EventCallback$.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement from "./japgolly.scalajs.react.vdom.VdomElement.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; -import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; -import * as $j_scala$002eFunction1 from "./scala.Function1.js"; -import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; -import * as $j_scala$002escalajs$002eruntime$002eWrappedVarArgs from "./scala.scalajs.runtime.WrappedVarArgs.js"; - -function $c_Ljapgolly_scalajs_react_test_emissions_UseState$() { - this.Ljapgolly_scalajs_react_test_emissions_UseState$__f_Component = null; - $n_Ljapgolly_scalajs_react_test_emissions_UseState$ = this; - - var rawComponent = arg1$2 => $m_Ljapgolly_scalajs_react_test_emissions_UseState$().japgolly$scalajs$react$test$emissions$UseState$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2); - - var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); - var this$1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); - var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$(), null)); - this.Ljapgolly_scalajs_react_test_emissions_UseState$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$1.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); -} - -export { $c_Ljapgolly_scalajs_react_test_emissions_UseState$ }; -$c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype = new $j_java$002elang$002eObject.$h_O(); -$c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_UseState$; - -function $h_Ljapgolly_scalajs_react_test_emissions_UseState$() {} - -export { $h_Ljapgolly_scalajs_react_test_emissions_UseState$ }; -$h_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype; - -$c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype.japgolly$scalajs$react$test$emissions$UseState$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box = function (props$1, __japgolly__hook1$1) { - return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box((props$1.a | 0) + (__japgolly__hook1$1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0); -}; - -$c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype.japgolly$scalajs$react$test$emissions$UseState$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box = function (__japgolly__hook3_ctx$1) { - var $$x3 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); - var $$x2 = __japgolly__hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; - var this$1 = __japgolly__hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; - var $$x1 = this$1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]; - var this$2 = __japgolly__hook3_ctx$1.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; - return $$x3.apply__O__Ljapgolly_scalajs_react_internal_Box((($$x2 | 0) + ($$x1 | 0) | 0) + (this$2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0); -}; - -$c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype.japgolly$scalajs$react$test$emissions$UseState$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s(function (props) { - _s(); - - var __japgolly__hook1_raw = $i_react.useState(() => { - $m_Ljapgolly_scalajs_react_test_emissions_UseState$(); - return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123); - }); - - var __japgolly__hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook1_raw); - - var __japgolly__hook2_raw = $i_react.useState(((props$1, __japgolly__hook1$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_UseState$().japgolly$scalajs$react$test$emissions$UseState$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box(props$1, __japgolly__hook1$1))(props, __japgolly__hook1)); - - var __japgolly__hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw); - - var props$2 = props.a; - - var __japgolly__hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$2, __japgolly__hook1, __japgolly__hook2); - - var __japgolly__hook3_raw = $i_react.useState((__japgolly__hook3_ctx$1 => () => $m_Ljapgolly_scalajs_react_test_emissions_UseState$().japgolly$scalajs$react$test$emissions$UseState$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box(__japgolly__hook3_ctx$1))(__japgolly__hook3_ctx)); - - var __japgolly__hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook3_raw); - - var sum = ((__japgolly__hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) + (__japgolly__hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0] | 0) | 0; - var $$x1 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); - $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); - $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); - var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((__japgolly__hook1$2 => () => { - $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); - var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(__japgolly__hook1$2); - return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$2$2 => { - var x$2 = x$2$2 | 0; - return 1 + x$2 | 0; - })).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline); - })(__japgolly__hook1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]; - var this$15 = $$x1.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("button", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); - return $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement.$f_Ljapgolly_scalajs_react_vdom_VdomElement__rawNode__sjs_js_$bar(this$15); -}, "MvKah7VQR05BGCgwm78KUH5C90w="); -var $d_Ljapgolly_scalajs_react_test_emissions_UseState$ = new $j_java$002elang$002eObject.$TypeData().initClass({ - Ljapgolly_scalajs_react_test_emissions_UseState$: 0 -}, false, "japgolly.scalajs.react.test.emissions.UseState$", { - Ljapgolly_scalajs_react_test_emissions_UseState$: 1, - O: 1 -}); -export { $d_Ljapgolly_scalajs_react_test_emissions_UseState$ }; -$c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_UseState$; -var $n_Ljapgolly_scalajs_react_test_emissions_UseState$; - -function $m_Ljapgolly_scalajs_react_test_emissions_UseState$() { - if (!$n_Ljapgolly_scalajs_react_test_emissions_UseState$) { - $n_Ljapgolly_scalajs_react_test_emissions_UseState$ = new $c_Ljapgolly_scalajs_react_test_emissions_UseState$(); - } - - ; - return $n_Ljapgolly_scalajs_react_test_emissions_UseState$; -} - -export { $m_Ljapgolly_scalajs_react_test_emissions_UseState$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out3.js deleted file mode 100644 index ce3de0b48..000000000 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseState-out3.js +++ /dev/null @@ -1,117 +0,0 @@ -'use strict'; - -import * as $i_react from "react"; -import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; -import * as $j_japgolly$002escalajs$002ereact$002eReusable$0024 from "./japgolly.scalajs.react.Reusable$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; -import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2 from "./japgolly.scalajs.react.hooks.HookCtx$P2.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; -import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF from "./japgolly.scalajs.react.hooks.Hooks$UseStateF.js"; -import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024 from "./japgolly.scalajs.react.vdom.Attr$EventCallback$.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite from "./japgolly.scalajs.react.vdom.TagLite.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagMod from "./japgolly.scalajs.react.vdom.TagMod.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; -import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; -import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; -import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; -import * as $j_scala$002eFunction1 from "./scala.Function1.js"; -import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; - -function $c_Ljapgolly_scalajs_react_test_emissions_UseState$() { - var _s = $RefreshSig$(); - - this.Ljapgolly_scalajs_react_test_emissions_UseState$__f_Component = null; - $n_Ljapgolly_scalajs_react_test_emissions_UseState$ = this; - - var rawComponent = props => { - _s(); - - var __japgolly__hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); - - var __japgolly__hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook1_raw); - - var __japgolly__hook2_raw = $i_react.useState(((props$2, __japgolly__hook1$2) => () => { - var $$x1 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); - var p = props$2.a | 0; - return $$x1.apply__O__Ljapgolly_scalajs_react_internal_Box(p + (__japgolly__hook1$2.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0); - })(props, __japgolly__hook1)); - - var __japgolly__hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw); - - var props$1 = props.a; - - var __japgolly__hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, __japgolly__hook1, __japgolly__hook2); - - var __japgolly__hook3_raw = $i_react.useState((__japgolly__hook3_ctx$2 => () => { - var $$x4 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); - var $$x3 = __japgolly__hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; - var this$4 = __japgolly__hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; - var $$x2 = this$4.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; - var this$5 = __japgolly__hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; - return $$x4.apply__O__Ljapgolly_scalajs_react_internal_Box((($$x3 | 0) + ($$x2 | 0) | 0) + (this$5.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0); - })(__japgolly__hook3_ctx)); - - var __japgolly__hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook3_raw); - - props.a | 0; - var sum = ((__japgolly__hook1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) + (__japgolly__hook2.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook3.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; - var this$14 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); - $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); - $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); - var self = "button"; - var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((__japgolly__hook1$3 => () => { - $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); - var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(__japgolly__hook1$3); - var ev$1 = r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$2 => { - var _$2$1 = _$2 | 0; - - return 1 + _$2$1 | 0; - })); - return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(ev$1 === null ? null : ev$1.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline); - })(__japgolly__hook1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)])); - var this$15 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$14, self, xs); - return this$15.rawElement__Ljapgolly_scalajs_react_facade_React$Element(); - }; - - _s(rawComponent, "OS8J16jWiM8/XN50US4YgU9Fqus="); - - var $$x5 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); - var this$16 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); - var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); - this.Ljapgolly_scalajs_react_test_emissions_UseState$__f_Component = $$x5.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$16.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); -} - -export { $c_Ljapgolly_scalajs_react_test_emissions_UseState$ }; -$c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype = new $j_java$002elang$002eObject.$h_O(); -$c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_UseState$; - -function $h_Ljapgolly_scalajs_react_test_emissions_UseState$() {} - -export { $h_Ljapgolly_scalajs_react_test_emissions_UseState$ }; -$h_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype; -var $d_Ljapgolly_scalajs_react_test_emissions_UseState$ = new $j_java$002elang$002eObject.$TypeData().initClass({ - Ljapgolly_scalajs_react_test_emissions_UseState$: 0 -}, false, "japgolly.scalajs.react.test.emissions.UseState$", { - Ljapgolly_scalajs_react_test_emissions_UseState$: 1, - O: 1 -}); -export { $d_Ljapgolly_scalajs_react_test_emissions_UseState$ }; -$c_Ljapgolly_scalajs_react_test_emissions_UseState$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_UseState$; -var $n_Ljapgolly_scalajs_react_test_emissions_UseState$; - -function $m_Ljapgolly_scalajs_react_test_emissions_UseState$() { - if (!$n_Ljapgolly_scalajs_react_test_emissions_UseState$) { - $n_Ljapgolly_scalajs_react_test_emissions_UseState$ = new $c_Ljapgolly_scalajs_react_test_emissions_UseState$(); - } - - ; - return $n_Ljapgolly_scalajs_react_test_emissions_UseState$; -} - -export { $m_Ljapgolly_scalajs_react_test_emissions_UseState$ }; From 17f5b096d8f013a83505b37feb0420e8f4f4c9b8 Mon Sep 17 00:00:00 2001 From: David Barri Date: Mon, 27 Jun 2022 10:16:37 +1000 Subject: [PATCH 67/72] Upgrade Scala.js and re-gen all emissions --- library/project/plugins.sbt | 2 +- .../resources/rr-sjr/HooksTrivial-out3.js | 24 +++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/library/project/plugins.sbt b/library/project/plugins.sbt index e6e430cbe..d61371d37 100644 --- a/library/project/plugins.sbt +++ b/library/project/plugins.sbt @@ -5,4 +5,4 @@ libraryDependencies ++= Seq( addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.0") addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10") addSbtPlugin("org.scala-js" % "sbt-jsdependencies" % "1.0.2") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.0") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.10.1") diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out3.js index a3b209de2..1b6d16a8b 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out3.js @@ -62,8 +62,8 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$() { var __japgolly__hook3 = $i_react.useContext((props.a | 0, this$3.Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_ctx.Ljapgolly_scalajs_react_feature_Context$$anon$3__f_raw)) | 0; - $i_react.useDebugValue(null, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$20 => { - if (_$20 !== null) { + $i_react.useDebugValue(null, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$25 => { + if (_$25 !== null) { throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); } @@ -71,16 +71,16 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$() { return "aaaaa"; })); props.a; - $i_react.useDebugValue(null, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$20$2 => { - if (_$20$2 !== null) { + $i_react.useDebugValue(null, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$25$2 => { + if (_$25$2 !== null) { throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); } ; return 321654; })); - $i_react.useDebugValue(null, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$20$3 => { - if (_$20$3 !== null) { + $i_react.useDebugValue(null, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$25$3 => { + if (_$25$3 !== null) { throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); } @@ -88,8 +88,8 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$() { return 987; })); - var __japgolly__hook7_raw = $i_react.useReducer($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().fromFunction2__F2__sjs_js_Function2($p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2(this$3, 0)), null, _$21 => { - if (_$21 !== null) { + var __japgolly__hook7_raw = $i_react.useReducer($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().fromFunction2__F2__sjs_js_Function2($p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2(this$3, 0)), null, _$26 => { + if (_$26 !== null) { throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); } @@ -103,8 +103,8 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$() { var $$x1 = $j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$(); var p = props.a | 0; - var __japgolly__hook8_raw = $$x2.useReducer($$x1.fromFunction2__F2__sjs_js_Function2($p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2(this$3, p)), null, ((props$2$1, __japgolly__hook1$2, __japgolly__hook2$2, __japgolly__hook3$2, __japgolly__hook7$2) => _$21$2 => { - if (_$21$2 !== null) { + var __japgolly__hook8_raw = $$x2.useReducer($$x1.fromFunction2__F2__sjs_js_Function2($p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2(this$3, p)), null, ((props$2$1, __japgolly__hook1$2, __japgolly__hook2$2, __japgolly__hook3$2, __japgolly__hook7$2) => _$26$2 => { + if (_$26$2 !== null) { throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); } @@ -125,8 +125,8 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$() { var $$x3 = $j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$(); var this$8 = __japgolly__hook9_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P4__f_hook4; - var __japgolly__hook9_raw = $$x4.useReducer($$x3.fromFunction2__F2__sjs_js_Function2($p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2(this$3, this$8.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0)), null, (__japgolly__hook9_ctx$2 => _$21$3 => { - if (_$21$3 !== null) { + var __japgolly__hook9_raw = $$x4.useReducer($$x3.fromFunction2__F2__sjs_js_Function2($p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2(this$3, this$8.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0)), null, (__japgolly__hook9_ctx$2 => _$26$3 => { + if (_$26$3 !== null) { throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); } From fc559e0999f80bec7c9a9dc66dfdeb61d25ca4b9 Mon Sep 17 00:00:00 2001 From: David Barri Date: Mon, 27 Jun 2022 11:11:04 +1000 Subject: [PATCH 68/72] Support render with reuse with children --- .../japgolly/scalajs/react/Reusability.scala | 3 ++ .../react/hooks/HookComponentBuilder.scala | 8 ++- .../scalajs/react/core/HooksTest.scala | 50 ++++++++++++++++--- 3 files changed, 53 insertions(+), 8 deletions(-) diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/Reusability.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/Reusability.scala index df2de38f6..1aaa855d2 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/Reusability.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/Reusability.scala @@ -286,6 +286,9 @@ object Reusability extends ReusabilityMacros with ScalaVersionSpecificReusabilit implicit def box[A: Reusability]: Reusability[Box[A]] = by(_.unbox) + implicit def propsChildren: Reusability[PropsChildren] = + apply((x, y) => x.raw == y.raw) + implicit def range: Reusability[Range] = byRefOr_== diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/HookComponentBuilder.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/HookComponentBuilder.scala index 76ef69bb4..939088ca1 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/HookComponentBuilder.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/HookComponentBuilder.scala @@ -4,7 +4,7 @@ import japgolly.scalajs.react.component.ScalaFn import japgolly.scalajs.react.component.ScalaFn.Component import japgolly.scalajs.react.internal.Box import japgolly.scalajs.react.vdom.VdomNode -import japgolly.scalajs.react.{Children, CtorType, PropsChildren, Reusability} +import japgolly.scalajs.react.{Children, CtorType, PropsChildren, Reusable, Reusability} object HookComponentBuilder { @@ -122,6 +122,12 @@ object HookComponentBuilder { def render(f: (P, PropsChildren) => VdomNode)(implicit s: CtorType.Summoner[Box[P], Children.Varargs]): Component[P, s.CT] = ScalaFn.withChildren(f) + def renderReusable[A](f: (P, PropsChildren) => Reusable[A])(implicit s: CtorType.Summoner[Box[P], Children.Varargs], v: A => VdomNode): Component[P, s.CT] = + renderReusable($ => f($.props, $.propsChildren)) + + def renderWithReuse(f: (P, PropsChildren) => VdomNode)(implicit s: CtorType.Summoner[Box[P], Children.Varargs], r: Reusability[Ctx]): Component[P, s.CT] = + renderWithReuse($ => f($.props, $.propsChildren)) + override def renderWithReuseBy[A](reusableInputs: Ctx => A)(f: A => VdomNode)(implicit s: CtorType.Summoner[Box[P], Children.Varargs], r: Reusability[A]): Component[P, s.CT] = customBy(ctx => CustomHook.shouldComponentUpdate(f).apply(() => reusableInputs(ctx))) .render((_: HookCtx.PC1[P, VdomNode]).hook1) diff --git a/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksTest.scala b/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksTest.scala index cf075cbdb..6526462a7 100644 --- a/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksTest.scala +++ b/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksTest.scala @@ -1235,6 +1235,39 @@ object HooksTest extends TestSuite { } } + private def testRenderWithReuseNeverPC(): Unit = { + implicit val reusability: Reusability[PI] = Reusability.never + + implicit val v: Reusability[japgolly.scalajs.react.hooks.HookCtx.PC0[PI]] = + japgolly.scalajs.react.hooks.HookCtx.reusabilityPC0 + + var renders = 0 + val comp = ScalaFnComponent.withHooks[PI] + .withPropsChildren + .renderWithReuse { (p, c) => + renders += 1 + <.div(s"P=$p, R=$renders", c) + } + + val wrapper = ScalaComponent.builder[PI] + .initialStateFromProps(identity) + .renderS { ($, s) => + <.div( + comp(s)("."), + <.button(^.onClick --> $.modState(_ + 0)), + <.button(^.onClick --> $.modState(_ + 1)), + ) + } + .build + + withRenderedIntoBody(wrapper(PI(3))) { (_, root) => + val t = new DomTester(root) + t.assertText("P=PI(3), R=1.") + t.clickButton(2); t.assertText("P=PI(4), R=2.") + t.clickButton(1); t.assertText("P=PI(4), R=3.") + } + } + private def testRenderWithReuseAndUseRef(): Unit = { val comp = ScalaFnComponent.withHooks[Unit] .useRef(100) @@ -1259,9 +1292,10 @@ object HooksTest extends TestSuite { private def testRenderWithReuseAndUseRefToVdom(): Unit = { var text = "uninitialised" val comp = ScalaFnComponent.withHooks[Unit] + .withPropsChildren .useRefToVdom[Input] .useState("x") - .renderWithReuse { (_, inputRef, s) => + .renderWithReuse { (_, c, inputRef, s) => def onChange(e: ReactEventFromInput): Callback = s.setState(e.target.value) @@ -1276,11 +1310,12 @@ object HooksTest extends TestSuite { <.div( <.input.text.withRef(inputRef)(^.value := s.value, ^.onChange ==> onChange), - <.button(^.onClick --> btn) + <.button(^.onClick --> btn), + c ) } - test(comp()) { t => + test(comp("!")) { t => t.assertInputText("x") t.clickButton() assertEq(text, "x") @@ -1394,10 +1429,11 @@ object HooksTest extends TestSuite { } "renderWithReuse" - { - "main" - testRenderWithReuse() - "never" - testRenderWithReuseNever() - "useRef" - testRenderWithReuseAndUseRef() - "useRefToVdom" - testRenderWithReuseAndUseRefToVdom() + "main" - testRenderWithReuse() // P, Secondary + "never" - testRenderWithReuseNever() // P, Primary + "neverC" - testRenderWithReuseNeverPC() // PC, Primary + "useRef" - testRenderWithReuseAndUseRef() // P, Secondary + "useRefToVdom" - testRenderWithReuseAndUseRefToVdom() // PC, Secondary } } } From c4cf1b30bf8cc88a0b2f10ed2942007ddf1a7fa9 Mon Sep 17 00:00:00 2001 From: David Barri Date: Mon, 27 Jun 2022 12:22:27 +1000 Subject: [PATCH 69/72] Fix Scala 2 compilation - stategy is fine Only polymorphic contexts need help, otherwise type inferance works fine (as confirmed in tests) --- .../scalajs/react/component/ScalaFn.scala | 4 +- .../react/hooks/HookComponentBuilder.scala | 13 +++-- .../scalajs/react/core/HooksTest.scala | 56 +++++++++++++++++-- 3 files changed, 60 insertions(+), 13 deletions(-) diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/component/ScalaFn.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/component/ScalaFn.scala index d3a2f80d1..78f9b6cd3 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/component/ScalaFn.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/component/ScalaFn.scala @@ -33,10 +33,10 @@ object ScalaFn { withHooks[P].renderWithReuseBy(reusableInputs)(render)(s, r) def withChildrenAndReuse[P](render: (P, PropsChildren) => VdomNode)(implicit s: CtorType.Summoner[Box[P], Children.Varargs], rp: Reusability[P], rc: Reusability[PropsChildren]): Component[P, s.CT] = - withHooks[P].withPropsChildren.renderWithReuse(i => render(i.props, i.propsChildren)) + withHooks[P].withPropsChildren.renderWithReuse(render) def withChildrenAndReuse[P, A](reusableInputs: (P, PropsChildren) => A)(render: A => VdomNode)(implicit s: CtorType.Summoner[Box[P], Children.Varargs], r: Reusability[A]): Component[P, s.CT] = - withHooks[P].withPropsChildren.renderWithReuseBy(i => reusableInputs(i.props, i.propsChildren))(render) + withHooks[P].withPropsChildren.renderWithReuseBy(reusableInputs)(render) // =================================================================================================================== diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/HookComponentBuilder.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/HookComponentBuilder.scala index 939088ca1..f962142fa 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/HookComponentBuilder.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/HookComponentBuilder.scala @@ -119,18 +119,21 @@ object HookComponentBuilder { override def render(f: Ctx => VdomNode)(implicit s: CtorType.Summoner[Box[P], Children.Varargs]): Component[P, s.CT] = ScalaFn.withChildren((p: P, pc: PropsChildren) => f(HookCtx.withChildren(p, pc))) + override def renderWithReuseBy[A](reusableInputs: Ctx => A)(f: A => VdomNode)(implicit s: CtorType.Summoner[Box[P], Children.Varargs], r: Reusability[A]): Component[P, s.CT] = + customBy(ctx => CustomHook.shouldComponentUpdate(f).apply(() => reusableInputs(ctx))) + .render((_: HookCtx.PC1[P, VdomNode]).hook1) + def render(f: (P, PropsChildren) => VdomNode)(implicit s: CtorType.Summoner[Box[P], Children.Varargs]): Component[P, s.CT] = ScalaFn.withChildren(f) def renderReusable[A](f: (P, PropsChildren) => Reusable[A])(implicit s: CtorType.Summoner[Box[P], Children.Varargs], v: A => VdomNode): Component[P, s.CT] = - renderReusable($ => f($.props, $.propsChildren)) + renderReusable(($: Ctx) => f($.props, $.propsChildren)) def renderWithReuse(f: (P, PropsChildren) => VdomNode)(implicit s: CtorType.Summoner[Box[P], Children.Varargs], r: Reusability[Ctx]): Component[P, s.CT] = - renderWithReuse($ => f($.props, $.propsChildren)) + renderWithReuse(($: Ctx) => f($.props, $.propsChildren)) - override def renderWithReuseBy[A](reusableInputs: Ctx => A)(f: A => VdomNode)(implicit s: CtorType.Summoner[Box[P], Children.Varargs], r: Reusability[A]): Component[P, s.CT] = - customBy(ctx => CustomHook.shouldComponentUpdate(f).apply(() => reusableInputs(ctx))) - .render((_: HookCtx.PC1[P, VdomNode]).hook1) + def renderWithReuseBy[A](reusableInputs: (P, PropsChildren) => A)(f: A => VdomNode)(implicit s: CtorType.Summoner[Box[P], Children.Varargs], r: Reusability[A]): Component[P, s.CT] = + renderWithReuseBy(($: Ctx) => reusableInputs($.props, $.propsChildren))(f) } type RenderFn[-P, +Ctx] = (Ctx => VdomNode) => (P, PropsChildren) => VdomNode diff --git a/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksTest.scala b/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksTest.scala index 6526462a7..32f0fcbdd 100644 --- a/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksTest.scala +++ b/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksTest.scala @@ -1272,7 +1272,9 @@ object HooksTest extends TestSuite { val comp = ScalaFnComponent.withHooks[Unit] .useRef(100) .useState(0) - .renderWithReuse { (_, ref, s) => + .renderWithReuse { $ => + val ref = $.hook1 + val s = $.hook2 <.div( ref.value, <.button(^.onClick --> ref.mod(_ + 1)), @@ -1327,6 +1329,47 @@ object HooksTest extends TestSuite { } } + private def testRenderWithReuseAndUseRefToVdomO(): Unit = { + var text = "uninitialised" + val comp = ScalaFnComponent.withHooks[Unit] + .withPropsChildren + .useRefToVdom[Input] + .useState("x") + .renderWithReuse { $ => + val c = $.propsChildren + val inputRef = $.hook1 + val s = $.hook2 + + def onChange(e: ReactEventFromInput): Callback = + s.setState(e.target.value) + + def btn: Callback = + for { + i <- inputRef.get.asCBO + // _ <- Callback.log(s"i.value = [${i.value}]") + } yield { + text = i.value + } + + <.div( + <.input.text.withRef(inputRef)(^.value := s.value, ^.onChange ==> onChange), + <.button(^.onClick --> btn), + c + ) + } + + test(comp("!")) { t => + t.assertInputText("x") + t.clickButton() + assertEq(text, "x") + + t.setInputText("hehe") + t.assertInputText("hehe") + t.clickButton() + assertEq(text, "hehe") + } + } + private def testPropsChildrenCtxObj(): Unit = { val inner = ScalaFnComponent.withHooks[Int] .withPropsChildren @@ -1429,11 +1472,12 @@ object HooksTest extends TestSuite { } "renderWithReuse" - { - "main" - testRenderWithReuse() // P, Secondary - "never" - testRenderWithReuseNever() // P, Primary - "neverC" - testRenderWithReuseNeverPC() // PC, Primary - "useRef" - testRenderWithReuseAndUseRef() // P, Secondary - "useRefToVdom" - testRenderWithReuseAndUseRefToVdom() // PC, Secondary + "main" - testRenderWithReuse() // P, Secondary, CtxFn + "never" - testRenderWithReuseNever() // P, Primary + "neverC" - testRenderWithReuseNeverPC() // PC, Primary + "useRef" - testRenderWithReuseAndUseRef() // P, Secondary, CtxObj + "useRefToVdom" - testRenderWithReuseAndUseRefToVdom() // PC, Secondary, CtxFn + "useRefToVdomO" - testRenderWithReuseAndUseRefToVdomO() // PC, Secondary, CtxObj } } } From ebfd7575c9b0261735b0a797c14a4d7a6c67f88e Mon Sep 17 00:00:00 2001 From: David Barri Date: Tue, 28 Jun 2022 14:44:18 +1000 Subject: [PATCH 70/72] Re-generate all test emissions with Scala.js 1.10.1 --- .../test/resources/rr-sjr/CustomHooks-out2.js | 4 +- .../test/resources/rr-sjr/CustomHooks-out3.js | 28 +-- .../resources/rr-sjr/HooksPrimative-out3.js | 6 +- .../resources/rr-sjr/HooksTrivial-out2.js | 26 +-- .../resources/rr-sjr/HooksTrivial-out3.js | 208 +++++++++--------- .../rr-sjr/HooksWithChildrenCtxFn-out2.js | 10 +- .../rr-sjr/HooksWithChildrenCtxFn-out3.js | 18 +- .../rr-sjr/HooksWithChildrenCtxObj-out3.js | 4 +- .../resources/rr-sjr/HooksWithJsFns-out2.js | 16 +- .../resources/rr-sjr/HooksWithJsFns-out3.js | 46 ++-- .../rr-sjr/HooksWithScalaFns-out2.js | 18 +- .../rr-sjr/HooksWithScalaFns-out3.js | 62 +++--- .../test/resources/rr-sjr/UseCallback-out2.js | 8 +- .../test/resources/rr-sjr/UseCallback-out3.js | 30 +-- .../test/resources/rr-sjr/UseEffect-out2.js | 18 +- .../test/resources/rr-sjr/UseEffect-out3.js | 70 +++--- .../src/test/resources/rr-sjr/UseMemo-out2.js | 109 +++++---- .../src/test/resources/rr-sjr/UseMemo-out3.js | 141 +++++++----- .../src/test/resources/rr-sjr/UseRef-out2.js | 4 +- .../src/test/resources/rr-sjr/UseRef-out3.js | 88 ++++---- .../rr-sjr/UseStateWithReuse-out2.js | 18 +- .../rr-sjr/UseStateWithReuse-out3.js | 82 +++---- 22 files changed, 529 insertions(+), 485 deletions(-) diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out2.js index 146382b9f..d8a16dcc5 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out2.js @@ -21,8 +21,8 @@ import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement from "./j import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; -import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002eArray$0024 from "./scala.Array$.js"; import * as $j_scala$002eFunction1 from "./scala.Function1.js"; import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; import * as $j_scala$002escalajs$002eruntime$002eWrappedVarArgs from "./scala.scalajs.runtime.WrappedVarArgs.js"; @@ -47,7 +47,7 @@ function $c_Ljapgolly_scalajs_react_test_emissions_CustomHooks$() { return x$2.Ljapgolly_scalajs_react_hooks_HookCtx$I1__f_hook1; })); var this$6 = $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_CustomHook.apply__Ljapgolly_scalajs_react_hooks_CustomHook$Builder$First(); - var effect = new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline("hello", $j_java$002elang$002eCharacter$0024.$m_sci_Nil$())); + var effect = new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline("hello", $j_scala$002eArray$0024.$m_sci_Nil$())); var a = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); var step$1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First.$c_Ljapgolly_scalajs_react_hooks_CustomHook$Builder$FirstStep(); this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eApi$0024Primary.$f_Ljapgolly_scalajs_react_hooks_Api$Primary__useEffect__O__F1__Ljapgolly_scalajs_react_hooks_Api$AbstractStep__O(this$6, effect, a, step$1).build__F1(); diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out3.js index 020699871..9d620dab1 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/CustomHooks-out3.js @@ -23,8 +23,8 @@ import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagMod from "./japgol import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; -import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002eArray$0024 from "./scala.Array$.js"; import * as $j_scala$002eFunction1 from "./scala.Function1.js"; import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; import * as $j_scala$002escalajs$002eruntime$002eCompat$0024 from "./scala.scalajs.runtime.Compat$.js"; @@ -50,10 +50,10 @@ function $c_Ljapgolly_scalajs_react_test_emissions_CustomHooks$() { return _$2$1.Ljapgolly_scalajs_react_hooks_HookCtx$I1__f_hook1; })); var this$8 = $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_CustomHook.apply__Ljapgolly_scalajs_react_hooks_CustomHook$Builder$First(); - var optionalParams$proxy1 = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); - var f$proxy3 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((optionalParams$proxy1$2 => () => { - console.log("hello", ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy1$2)); - })(optionalParams$proxy1)); + var optionalParams$proxy1 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); + var f$proxy3 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + console.log("hello", ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy1)); + }); var effect = new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy3))); var a = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); var step$1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Builder$0024First.$c_Ljapgolly_scalajs_react_hooks_CustomHook$Builder$FirstStep(); @@ -99,30 +99,30 @@ function $c_Ljapgolly_scalajs_react_test_emissions_CustomHooks$() { return _$9$1.Ljapgolly_scalajs_react_hooks_HookCtx$I1__f_hook1; })); - var rawComponent = (this$12$1 => props => { + var rawComponent = props => { var __japgolly__hook1_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024Arg$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$Arg$().exactId__F1().apply__O__O(props.a) | 0; - var __japgolly__hook1 = this$12$1.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook1.apply__O__O(__japgolly__hook1_arg); + var __japgolly__hook1 = this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook1.apply__O__O(__japgolly__hook1_arg); - this$12$1.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook2.apply__O__O(void 0); + this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook2.apply__O__O(void 0); - var __japgolly__hook3 = this$12$1.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook3.apply__O__O(void 0); + var __japgolly__hook3 = this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook3.apply__O__O(void 0); var p = props.a | 0; - var __japgolly__hook4_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1(this$12$1.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook4, -1 + p | 0); + var __japgolly__hook4_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1(this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook4, -1 + p | 0); var __japgolly__hook4 = __japgolly__hook4_raw.apply__O__O(void 0); props.a | 0; - var __japgolly__hook5_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1(this$12$1.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook5, __japgolly__hook4.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); + var __japgolly__hook5_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1(this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook5, __japgolly__hook4.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); var __japgolly__hook5 = __japgolly__hook5_raw.apply__O__O(void 0); props.a; - var __japgolly__hook6_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1(this$12$1.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook6, __japgolly__hook5.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); + var __japgolly__hook6_raw = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().apply$extension__F1__O__F1(this.Ljapgolly_scalajs_react_test_emissions_CustomHooks$__f_customHook6, __japgolly__hook5.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]); var __japgolly__hook6 = __japgolly__hook6_raw.apply__O__O(void 0); @@ -132,10 +132,10 @@ function $c_Ljapgolly_scalajs_react_test_emissions_CustomHooks$() { $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); var self = "div"; - var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum))])); + var xs = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum))])); var this$25 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$24, self, xs); return this$25.rawElement__Ljapgolly_scalajs_react_facade_React$Element(); - })(this); + }; var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); var this$26 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksPrimative-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksPrimative-out3.js index 365448927..7c0314af8 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksPrimative-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksPrimative-out3.js @@ -51,7 +51,7 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$() { this.Ljapgolly_scalajs_react_test_emissions_HooksPrimative$__f_Component = null; $n_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$ = this; - var rawComponent = (this$1 => props => { + var rawComponent = props => { new $j_scala$002eruntime$002eLazyInt.$c_sr_LazyInt(); var __japgolly__hook5_raw$lzy1 = new $j_scala$002eruntime$002eLazyInt.$c_sr_LazyInt(); @@ -80,9 +80,9 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$() { props.a; console.log("ccccc"); props.a; - var sum = (((((11110 + $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$____japgolly__hook5_raw$1__sr_LazyInt__I(this$1, __japgolly__hook5_raw$lzy1$2) | 0) + $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$____japgolly__hook6_raw$1__sr_LazyInt__I(this$1, __japgolly__hook6_raw$lzy1$2) | 0) + (__japgolly__hook7.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + (__japgolly__hook8.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + (__japgolly__hook9.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + ("bbbbb".length | 0) | 0; + var sum = (((((11110 + $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$____japgolly__hook5_raw$1__sr_LazyInt__I(this, __japgolly__hook5_raw$lzy1$2) | 0) + $p_Ljapgolly_scalajs_react_test_emissions_HooksPrimative$____japgolly__hook6_raw$1__sr_LazyInt__I(this, __japgolly__hook6_raw$lzy1$2) | 0) + (__japgolly__hook7.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + (__japgolly__hook8.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + (__japgolly__hook9.Ljapgolly_scalajs_react_hooks_Hooks$VarF__f_value | 0) | 0) + ("bbbbb".length | 0) | 0; return ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; - })(this); + }; var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); var this$14 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out2.js index ed634263a..463a552ae 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out2.js @@ -32,11 +32,11 @@ import * as $j_scala$002escalajs$002eruntime$002eAnonFunction2 from "./scala.sca import * as $j_scala$002escalajs$002eruntime$002eWrappedVarArgs from "./scala.scalajs.runtime.WrappedVarArgs.js"; function $p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2($thiz, n) { - return new $j_scala$002escalajs$002eruntime$002eAnonFunction2.$c_sjsr_AnonFunction2((n$1 => (x$1$2, x$2$2) => { + return new $j_scala$002escalajs$002eruntime$002eAnonFunction2.$c_sjsr_AnonFunction2((x$1$2, x$2$2) => { var x$1 = x$1$2 | 0; var x$2 = x$2$2 | 0; - return (x$1 + x$2 | 0) + n$1 | 0; - })(n)); + return (x$1 + x$2 | 0) + n | 0; + }); } export { $p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2 }; @@ -138,15 +138,15 @@ $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$.prototype.japgolly$scala var __japgolly__hook7 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseReducer$().fromJs__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer(__japgolly__hook7_raw); - var __japgolly__hook8_raw = $i_react.useReducer($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().fromFunction2__F2__sjs_js_Function2($p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2($m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$(), props.a | 0)), null, ((props$1$1, __japgolly__hook1$1, __japgolly__hook2$1, __japgolly__hook3$1, __japgolly__hook7$1) => arg1$2$1 => { + var __japgolly__hook8_raw = $i_react.useReducer($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().fromFunction2__F2__sjs_js_Function2($p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2($m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$(), props.a | 0)), null, arg1$2$1 => { if (arg1$2$1 !== null) { throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); } ; var arg1$1 = null; - return $m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$().japgolly$scalajs$react$test$emissions$HooksTrivial$$$anonfun$Component$6__N__Ljapgolly_scalajs_react_internal_Box__I__I__I__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__I(arg1$1, props$1$1, __japgolly__hook1$1, __japgolly__hook2$1, __japgolly__hook3$1, __japgolly__hook7$1); - })(props, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3, __japgolly__hook7)); + return $m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$().japgolly$scalajs$react$test$emissions$HooksTrivial$$$anonfun$Component$6__N__Ljapgolly_scalajs_react_internal_Box__I__I__I__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__I(arg1$1, props, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3, __japgolly__hook7); + }); var __japgolly__hook8 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseReducer$().fromJs__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer(__japgolly__hook8_raw); @@ -159,15 +159,15 @@ $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$.prototype.japgolly$scala var $$x1 = $m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$(); var this$5 = __japgolly__hook9_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P4__f_hook4; - var __japgolly__hook9_raw = $$x3.useReducer($$x2.fromFunction2__F2__sjs_js_Function2($p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2($$x1, this$5.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0)), null, (__japgolly__hook9_ctx$1 => arg1$2$2 => { + var __japgolly__hook9_raw = $$x3.useReducer($$x2.fromFunction2__F2__sjs_js_Function2($p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2($$x1, this$5.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0)), null, arg1$2$2 => { if (arg1$2$2 !== null) { throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); } ; var arg1$3 = null; - return $m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$().japgolly$scalajs$react$test$emissions$HooksTrivial$$$anonfun$Component$7__N__Ljapgolly_scalajs_react_hooks_HookCtx$P5__I(arg1$3, __japgolly__hook9_ctx$1); - })(__japgolly__hook9_ctx)); + return $m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$().japgolly$scalajs$react$test$emissions$HooksTrivial$$$anonfun$Component$7__N__Ljapgolly_scalajs_react_hooks_HookCtx$P5__I(arg1$3, __japgolly__hook9_ctx); + }); var __japgolly__hook9 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseReducer$().fromJs__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer(__japgolly__hook9_raw); @@ -178,7 +178,7 @@ $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$.prototype.japgolly$scala var __japgolly__hook10 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook10_raw); - var __japgolly__hook11_raw = $i_react.useState(((props$1$2, __japgolly__hook1$1$1, __japgolly__hook9$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$().japgolly$scalajs$react$test$emissions$HooksTrivial$$$anonfun$Component$9__Ljapgolly_scalajs_react_internal_Box__I__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__Ljapgolly_scalajs_react_internal_Box(props$1$2, __japgolly__hook1$1$1, __japgolly__hook9$1))(props, __japgolly__hook1, __japgolly__hook9)); + var __japgolly__hook11_raw = $i_react.useState(() => $m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$().japgolly$scalajs$react$test$emissions$HooksTrivial$$$anonfun$Component$9__Ljapgolly_scalajs_react_internal_Box__I__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__Ljapgolly_scalajs_react_internal_Box(props, __japgolly__hook1, __japgolly__hook9)); var __japgolly__hook11 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook11_raw); @@ -186,7 +186,7 @@ $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$.prototype.japgolly$scala var __japgolly__hook12_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P8.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P8(props$4, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3, __japgolly__hook7, __japgolly__hook8, __japgolly__hook9, __japgolly__hook10, __japgolly__hook11); - var __japgolly__hook12_raw = $i_react.useState((__japgolly__hook12_ctx$1 => () => $m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$().japgolly$scalajs$react$test$emissions$HooksTrivial$$$anonfun$Component$10__Ljapgolly_scalajs_react_hooks_HookCtx$P8__Ljapgolly_scalajs_react_internal_Box(__japgolly__hook12_ctx$1))(__japgolly__hook12_ctx)); + var __japgolly__hook12_raw = $i_react.useState(() => $m_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$().japgolly$scalajs$react$test$emissions$HooksTrivial$$$anonfun$Component$10__Ljapgolly_scalajs_react_hooks_HookCtx$P8__Ljapgolly_scalajs_react_internal_Box(__japgolly__hook12_ctx)); var __japgolly__hook12 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook12_raw); @@ -198,10 +198,10 @@ $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$.prototype.japgolly$scala var $$x4 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); - var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((__japgolly__hook13$1 => () => __japgolly__hook13$1)(__japgolly__hook13)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().reusableDefaultSync__F1())]; + var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => __japgolly__hook13), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().reusableDefaultSync__F1())]; var this$15 = $$x4.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("div", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); return $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement.$f_Ljapgolly_scalajs_react_vdom_VdomElement__rawNode__sjs_js_$bar(this$15); -}, "fNOJzNkli90WVir2fr+rau+iRmE=", true); +}, "lR/p6iCdK9mrQXLpqrMrWz0y4PM=", true); var $d_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$ = new $j_java$002elang$002eObject.$TypeData().initClass({ Ljapgolly_scalajs_react_test_emissions_HooksTrivial$: 0 }, false, "japgolly.scalajs.react.test.emissions.HooksTrivial$", { diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out3.js index 1b6d16a8b..6ebf90ac7 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksTrivial-out3.js @@ -21,171 +21,171 @@ import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagMod from "./japgol import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; -import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; import * as $j_java$002elang$002eClassCastException from "./java.lang.ClassCastException.js"; import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002eArray$0024 from "./scala.Array$.js"; import * as $j_scala$002eFunction1 from "./scala.Function1.js"; import * as $j_scala$002escalajs$002ejs$002eAny$0024 from "./scala.scalajs.js.Any$.js"; import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; import * as $j_scala$002escalajs$002eruntime$002eAnonFunction2 from "./scala.scalajs.runtime.AnonFunction2.js"; function $p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2($thiz, n) { - return new $j_scala$002escalajs$002eruntime$002eAnonFunction2.$c_sjsr_AnonFunction2((n$2 => (_$1, _$2) => { + return new $j_scala$002escalajs$002eruntime$002eAnonFunction2.$c_sjsr_AnonFunction2((_$1, _$2) => { var _$1$1 = _$1 | 0; var _$2$1 = _$2 | 0; - return (_$1$1 + _$2$1 | 0) + n$2 | 0; - })(n)); + return (_$1$1 + _$2$1 | 0) + n | 0; + }); } export { $p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2 }; function $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$() { + var _s = $RefreshSig$(); + this.Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_ctx = null; this.Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_Component = null; $n_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$ = this; var this$1 = $j_japgolly$002escalajs$002ereact$002eReact$0024.$m_Ljapgolly_scalajs_react_React$(); this.Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_ctx = new $j_japgolly$002escalajs$002ereact$002efeature$002eContext$0024$0024anon$00243.$c_Ljapgolly_scalajs_react_feature_Context$$anon$3(100); - var rawComponent = (this$3 => { - var _s = $RefreshSig$(); + var rawComponent = props => { + _s(); - return _s(props => { - _s(); + var __japgolly__hook1 = $i_react.useContext(this.Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_ctx.Ljapgolly_scalajs_react_feature_Context$$anon$3__f_raw) | 0; - var __japgolly__hook1 = $i_react.useContext(this$3.Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_ctx.Ljapgolly_scalajs_react_feature_Context$$anon$3__f_raw) | 0; + props.a; - props.a; + var __japgolly__hook2 = $i_react.useContext(this.Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_ctx.Ljapgolly_scalajs_react_feature_Context$$anon$3__f_raw) | 0; - var __japgolly__hook2 = $i_react.useContext(this$3.Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_ctx.Ljapgolly_scalajs_react_feature_Context$$anon$3__f_raw) | 0; + var __japgolly__hook3 = $i_react.useContext((props.a | 0, this.Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_ctx.Ljapgolly_scalajs_react_feature_Context$$anon$3__f_raw)) | 0; - var __japgolly__hook3 = $i_react.useContext((props.a | 0, this$3.Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_ctx.Ljapgolly_scalajs_react_feature_Context$$anon$3__f_raw)) | 0; + $i_react.useDebugValue(null, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$25 => { + if (_$25 !== null) { + throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); + } - $i_react.useDebugValue(null, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$25 => { - if (_$25 !== null) { - throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); - } + ; + return "aaaaa"; + })); + props.a; + $i_react.useDebugValue(null, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$25$2 => { + if (_$25$2 !== null) { + throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); + } - ; - return "aaaaa"; - })); - props.a; - $i_react.useDebugValue(null, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$25$2 => { - if (_$25$2 !== null) { - throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); - } + ; + return 321654; + })); + $i_react.useDebugValue(null, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$25$3 => { + if (_$25$3 !== null) { + throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); + } - ; - return 321654; - })); - $i_react.useDebugValue(null, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$25$3 => { - if (_$25$3 !== null) { - throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); - } + ; + return 987; + })); - ; - return 987; - })); + var __japgolly__hook7_raw = $i_react.useReducer($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().fromFunction2__F2__sjs_js_Function2($p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2(this, 0)), null, _$26 => { + if (_$26 !== null) { + throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); + } - var __japgolly__hook7_raw = $i_react.useReducer($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().fromFunction2__F2__sjs_js_Function2($p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2(this$3, 0)), null, _$26 => { - if (_$26 !== null) { - throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); - } + ; + return 100; + }); - ; - return 100; - }); + var __japgolly__hook7 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseReducer$().fromJs__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer(__japgolly__hook7_raw); - var __japgolly__hook7 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseReducer$().fromJs__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer(__japgolly__hook7_raw); + var $$x2 = $i_react; + var $$x1 = $j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$(); + var p = props.a | 0; - var $$x2 = $i_react; - var $$x1 = $j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$(); - var p = props.a | 0; + var __japgolly__hook8_raw = $$x2.useReducer($$x1.fromFunction2__F2__sjs_js_Function2($p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2(this, p)), null, _$26$2 => { + if (_$26$2 !== null) { + throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); + } - var __japgolly__hook8_raw = $$x2.useReducer($$x1.fromFunction2__F2__sjs_js_Function2($p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2(this$3, p)), null, ((props$2$1, __japgolly__hook1$2, __japgolly__hook2$2, __japgolly__hook3$2, __japgolly__hook7$2) => _$26$2 => { - if (_$26$2 !== null) { - throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); - } + ; - ; + var _$16 = props.a | 0; - var _$16 = props$2$1.a | 0; + return (((_$16 + __japgolly__hook1 | 0) + __japgolly__hook2 | 0) + __japgolly__hook3 | 0) + (__japgolly__hook7.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0; + }); - return (((_$16 + __japgolly__hook1$2 | 0) + __japgolly__hook2$2 | 0) + __japgolly__hook3$2 | 0) + (__japgolly__hook7$2.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0; - })(props, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3, __japgolly__hook7)); + var __japgolly__hook8 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseReducer$().fromJs__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer(__japgolly__hook8_raw); - var __japgolly__hook8 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseReducer$().fromJs__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer(__japgolly__hook8_raw); + var props$3 = props.a; - var props$3 = props.a; + var __japgolly__hook9_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P5.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P5__O__O__O__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P5.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P5(), props$3, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3, __japgolly__hook7, __japgolly__hook8); - var __japgolly__hook9_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P5.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P5__O__O__O__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P5.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P5(), props$3, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3, __japgolly__hook7, __japgolly__hook8); + var $$x4 = $i_react; + var $$x3 = $j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$(); + var this$7 = __japgolly__hook9_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P4__f_hook4; - var $$x4 = $i_react; - var $$x3 = $j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$(); - var this$8 = __japgolly__hook9_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P4__f_hook4; + var __japgolly__hook9_raw = $$x4.useReducer($$x3.fromFunction2__F2__sjs_js_Function2($p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2(this, this$7.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0)), null, _$26$3 => { + if (_$26$3 !== null) { + throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); + } - var __japgolly__hook9_raw = $$x4.useReducer($$x3.fromFunction2__F2__sjs_js_Function2($p_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__add__I__F2(this$3, this$8.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0)), null, (__japgolly__hook9_ctx$2 => _$26$3 => { - if (_$26$3 !== null) { - throw new $j_java$002elang$002eClassCastException.$c_jl_ClassCastException(); - } + ; + var $$x6 = __japgolly__hook9_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + var this$8 = __japgolly__hook9_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P4__f_hook4; + var $$x5 = this$8.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0]; + var this$9 = __japgolly__hook9_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P5__f_hook5; + return (($$x6 | 0) + ($$x5 | 0) | 0) + (this$9.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0; + }); - ; - var $$x6 = __japgolly__hook9_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; - var this$9 = __japgolly__hook9_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P4__f_hook4; - var $$x5 = this$9.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0]; - var this$10 = __japgolly__hook9_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P5__f_hook5; - return (($$x6 | 0) + ($$x5 | 0) | 0) + (this$10.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0; - })(__japgolly__hook9_ctx)); + var __japgolly__hook9 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseReducer$().fromJs__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer(__japgolly__hook9_raw); - var __japgolly__hook9 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseReducer$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseReducer$().fromJs__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseReducer(__japgolly__hook9_raw); + var __japgolly__hook10_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); - var __japgolly__hook10_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); + var __japgolly__hook10 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook10_raw); - var __japgolly__hook10 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook10_raw); + var __japgolly__hook11_raw = $i_react.useState(() => { + var $$x7 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); + var p$1 = props.a | 0; + return $$x7.apply__O__Ljapgolly_scalajs_react_internal_Box((p$1 + __japgolly__hook1 | 0) + (__japgolly__hook9.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0); + }); - var __japgolly__hook11_raw = $i_react.useState(((props$3$1, __japgolly__hook1$3, __japgolly__hook9$2) => () => { - var $$x7 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); - var p$1 = props$3$1.a | 0; - return $$x7.apply__O__Ljapgolly_scalajs_react_internal_Box((p$1 + __japgolly__hook1$3 | 0) + (__japgolly__hook9$2.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0); - })(props, __japgolly__hook1, __japgolly__hook9)); + var __japgolly__hook11 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook11_raw); - var __japgolly__hook11 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook11_raw); + var props$4 = props.a; - var props$4 = props.a; + var __japgolly__hook12_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P8.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P8(props$4, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3, __japgolly__hook7, __japgolly__hook8, __japgolly__hook9, __japgolly__hook10, __japgolly__hook11); - var __japgolly__hook12_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P8.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P8(props$4, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3, __japgolly__hook7, __japgolly__hook8, __japgolly__hook9, __japgolly__hook10, __japgolly__hook11); + var __japgolly__hook12_raw = $i_react.useState(() => { + var $$x10 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); + var $$x9 = __japgolly__hook12_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + var $$x8 = __japgolly__hook12_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; + var this$11 = __japgolly__hook12_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P6__f_hook6; + return $$x10.apply__O__Ljapgolly_scalajs_react_internal_Box((($$x9 | 0) + ($$x8 | 0) | 0) + (this$11.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0); + }); - var __japgolly__hook12_raw = $i_react.useState((__japgolly__hook12_ctx$2 => () => { - var $$x10 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); - var $$x9 = __japgolly__hook12_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; - var $$x8 = __japgolly__hook12_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; - var this$12 = __japgolly__hook12_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P6__f_hook6; - return $$x10.apply__O__Ljapgolly_scalajs_react_internal_Box((($$x9 | 0) + ($$x8 | 0) | 0) + (this$12.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0); - })(__japgolly__hook12_ctx)); + var __japgolly__hook12 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook12_raw); - var __japgolly__hook12 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook12_raw); + var __japgolly__hook13_state = $i_react.useState(0); - var __japgolly__hook13_state = $i_react.useState(0); + var __japgolly__hook13 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().useForceUpdateRaw__sjs_js_Tuple2__Ljapgolly_scalajs_react_Reusable(__japgolly__hook13_state); - var __japgolly__hook13 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().useForceUpdateRaw__sjs_js_Tuple2__Ljapgolly_scalajs_react_Reusable(__japgolly__hook13_state); + props.a | 0; + var sum = (((((((__japgolly__hook1 + __japgolly__hook2 | 0) + __japgolly__hook3 | 0) + (__japgolly__hook7.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0) + (__japgolly__hook8.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0) + (__japgolly__hook9.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0) + (__japgolly__hook10.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook11.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook12.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; + var this$16 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self = "div"; + var xs = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => __japgolly__hook13), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().reusableDefaultSync__F1())])); + var this$17 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$16, self, xs); + return this$17.rawElement__Ljapgolly_scalajs_react_facade_React$Element(); + }; - props.a | 0; - var sum = (((((((__japgolly__hook1 + __japgolly__hook2 | 0) + __japgolly__hook3 | 0) + (__japgolly__hook7.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0) + (__japgolly__hook8.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0) + (__japgolly__hook9.Ljapgolly_scalajs_react_hooks_Hooks$UseReducer__f_raw[0] | 0) | 0) + (__japgolly__hook10.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook11.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (__japgolly__hook12.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; - var this$17 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); - $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); - $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); - var self = "div"; - var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((__japgolly__hook13$2 => () => __japgolly__hook13$2)(__japgolly__hook13)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().reusableDefaultSync__F1())])); - var this$18 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$17, self, xs); - return this$18.rawElement__Ljapgolly_scalajs_react_facade_React$Element(); - }, "JpVURmOEfTlG2I9fy8EuJSQSlcs=", true); - })(this); + _s(rawComponent, "3SdfNYeztHmjlpzAvh9HLOvumYA=", true); var $$x11 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); - var this$19 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var this$18 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); - this.Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_Component = $$x11.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$19.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); + this.Ljapgolly_scalajs_react_test_emissions_HooksTrivial$__f_Component = $$x11.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$18.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); } export { $c_Ljapgolly_scalajs_react_test_emissions_HooksTrivial$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxFn-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxFn-out2.js index 05e768bdd..a59ef8c53 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxFn-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxFn-out2.js @@ -61,16 +61,16 @@ $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$.prototype.japg var $$x1 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); - var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((__japgolly__hook1$1 => () => { + var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); - var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(__japgolly__hook1$1); + var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(__japgolly__hook1); return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$1$2 => { var x$1 = x$1$2 | 0; return 1 + x$1 | 0; })).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline); - })(__japgolly__hook1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(children))]; - var this$17 = $$x1.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("button", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); - return $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement.$f_Ljapgolly_scalajs_react_vdom_VdomElement__rawNode__sjs_js_$bar(this$17); + }), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(children))]; + var this$16 = $$x1.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("button", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); + return $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement.$f_Ljapgolly_scalajs_react_vdom_VdomElement__rawNode__sjs_js_$bar(this$16); }, "nfv15B7PjZ4t48VEMZ2SuYrvgqI="); var $d_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$ = new $j_java$002elang$002eObject.$TypeData().initClass({ Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$: 0 diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxFn-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxFn-out3.js index b8ec9cc0f..91f09a828 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxFn-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxFn-out3.js @@ -18,8 +18,8 @@ import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagMod from "./japgol import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; -import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002eArray$0024 from "./scala.Array$.js"; import * as $j_scala$002eFunction1 from "./scala.Function1.js"; import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; @@ -40,30 +40,30 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$() { var p = props.a | 0; var sum = (p + (__japgolly__hook1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + ($i_react.Children.count(children) | 0) | 0; - var this$15 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + var this$13 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); var self = "button"; - var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((__japgolly__hook1$2 => () => { + var xs = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); - var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(__japgolly__hook1$2); + var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(__japgolly__hook1); var ev$1 = r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$1 => { var _$1$1 = _$1 | 0; return 1 + _$1$1 | 0; })); return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(ev$1 === null ? null : ev$1.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline); - })(__japgolly__hook1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(children))])); - var this$16 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$15, self, xs); - return this$16.rawElement__Ljapgolly_scalajs_react_facade_React$Element(); + }), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(children))])); + var this$14 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$13, self, xs); + return this$14.rawElement__Ljapgolly_scalajs_react_facade_React$Element(); }; _s(rawComponent, "5jozhEwtxvMwDXdJFU53ltHZ+8U="); var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); - var this$17 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var this$15 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonPC__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); - this.Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$17.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); + this.Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$15.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); } export { $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxFn$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxObj-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxObj-out3.js index 05590dc32..414dc311c 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxObj-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithChildrenCtxObj-out3.js @@ -35,9 +35,9 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$() { _s(rawComponent, "5jozhEwtxvMwDXdJFU53ltHZ+8U="); var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); - var this$7 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var this$6 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonPC__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); - this.Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$7.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); + this.Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$__f_Component = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$6.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); } export { $c_Ljapgolly_scalajs_react_test_emissions_HooksWithChildrenCtxObj$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out2.js index aba174383..cc675eb74 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out2.js @@ -92,14 +92,14 @@ $c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$.prototype.japgolly$sca var $$x1 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); - var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((s1$1 => () => { + var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); - var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(s1$1); + var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(s1); return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$3$2 => { var x$3 = x$3$2 | 0; return 1 + x$3 | 0; })).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline); - })(s1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]; + }), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]; return $$x1.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("button", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); }; @@ -121,20 +121,20 @@ $c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$.prototype.japgolly$sca var __japgolly__hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook1_raw); - var __japgolly__hook2_raw = $i_react.useState(((props$1, __japgolly__hook1$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$().japgolly$scalajs$react$test$emissions$HooksWithJsFns$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box(props$1, __japgolly__hook1$1))(props, __japgolly__hook1)); + var __japgolly__hook2_raw = $i_react.useState(() => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$().japgolly$scalajs$react$test$emissions$HooksWithJsFns$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box(props, __japgolly__hook1)); var __japgolly__hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw); - var props$2 = props.a; + var props$1 = props.a; - var __japgolly__hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$2, __japgolly__hook1, __japgolly__hook2); + var __japgolly__hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, __japgolly__hook1, __japgolly__hook2); - var __japgolly__hook3_raw = $i_react.useState((__japgolly__hook3_ctx$1 => () => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$().japgolly$scalajs$react$test$emissions$HooksWithJsFns$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box(__japgolly__hook3_ctx$1))(__japgolly__hook3_ctx)); + var __japgolly__hook3_raw = $i_react.useState(() => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$().japgolly$scalajs$react$test$emissions$HooksWithJsFns$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box(__japgolly__hook3_ctx)); var __japgolly__hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook3_raw); return $j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction4__sjs_js_Function4__F4($p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__render__sjs_js_Function4($m_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$())).apply__O__O__O__O__O(props.a, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3).rawNode__sjs_js_$bar(); -}, "xmX5jTEGNoPOyfRzbmyGUWBpKps="); +}, "bYmfixlBDAOCGTWfjyExliA5/bY="); var $d_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$ = new $j_java$002elang$002eObject.$TypeData().initClass({ Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$: 0 }, false, "japgolly.scalajs.react.test.emissions.HooksWithJsFns$", { diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out3.js index 4bc344947..2d9bb131f 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithJsFns-out3.js @@ -19,8 +19,8 @@ import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode from "./japg import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; -import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002eArray$0024 from "./scala.Array$.js"; import * as $j_scala$002eFunction1 from "./scala.Function1.js"; import * as $j_scala$002escalajs$002ejs$002eAny$0024 from "./scala.scalajs.js.Any$.js"; import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; @@ -43,27 +43,29 @@ function $p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__render__sjs_ var s2$1 = s2; var s3$1 = s3; var sum = ((p$1 + (s1$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (s2$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (s3$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; - var this$11 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + var this$9 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); var self = "button"; - var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((s1$2 => () => { + var xs = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); - var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(s1$2); + var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(s1$1); var ev$1 = r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$3 => { var _$3$1 = _$3 | 0; return 1 + _$3$1 | 0; })); return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(ev$1 === null ? null : ev$1.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline); - })(s1$1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)])); - return $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$11, self, xs); + }), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)])); + return $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$9, self, xs); }; } export { $p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__render__sjs_js_Function4 }; function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$() { + var _s = $RefreshSig$(); + this.Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__f_jsState2 = null; this.Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__f_Component = null; $n_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$ = this; @@ -77,36 +79,34 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$() { return (($$x2 | 0) + ($$x1 | 0) | 0) + (this$3.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; }; - var rawComponent = (this$2$1 => { - var _s = $RefreshSig$(); + var rawComponent = props => { + _s(); - return _s(props => { - _s(); + var __japgolly__hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); - var __japgolly__hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); + var __japgolly__hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook1_raw); - var __japgolly__hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook1_raw); + var __japgolly__hook2_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction2__sjs_js_Function2__F2($p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__jsState1__sjs_js_Function2(this)).apply__O__O__O(props.a, __japgolly__hook1))); - var __japgolly__hook2_raw = $i_react.useState(((this$2$2, props$2, __japgolly__hook1$2) => () => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction2__sjs_js_Function2__F2($p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__jsState1__sjs_js_Function2(this$2$2)).apply__O__O__O(props$2.a, __japgolly__hook1$2)))(this$2$1, props, __japgolly__hook1)); + var __japgolly__hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw); - var __japgolly__hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw); + var props$1 = props.a; - var props$1 = props.a; + var __japgolly__hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, __japgolly__hook1, __japgolly__hook2); - var __japgolly__hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, __japgolly__hook1, __japgolly__hook2); + var __japgolly__hook3_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction1__sjs_js_Function1__F1(this.Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__f_jsState2).apply__O__O(__japgolly__hook3_ctx))); - var __japgolly__hook3_raw = $i_react.useState(((this$3$1, __japgolly__hook3_ctx$2) => () => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction1__sjs_js_Function1__F1(this$3$1.Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__f_jsState2).apply__O__O(__japgolly__hook3_ctx$2)))(this$2$1, __japgolly__hook3_ctx)); + var __japgolly__hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook3_raw); - var __japgolly__hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook3_raw); + return $j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction4__sjs_js_Function4__F4($p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__render__sjs_js_Function4(this)).apply__O__O__O__O__O(props.a, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3).rawNode__O(); + }; - return $j_scala$002escalajs$002ejs$002eAny$0024.$m_sjs_js_Any$().toFunction4__sjs_js_Function4__F4($p_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__render__sjs_js_Function4(this$2$1)).apply__O__O__O__O__O(props.a, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3).rawNode__O(); - }, "cizXrFiX1+uWSjp+P70KP4g8wZM="); - })(this); + _s(rawComponent, "3lIf5hg6fCL6+CfO6zF6TbnM+6M="); var $$x3 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); - var this$6 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var this$5 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); - this.Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__f_Component = $$x3.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$6.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); + this.Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$__f_Component = $$x3.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$5.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); } export { $c_Ljapgolly_scalajs_react_test_emissions_HooksWithJsFns$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out2.js index b056fb50c..3b916148d 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out2.js @@ -37,14 +37,14 @@ function $p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__render__I var $$x1 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); - var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((s1$1 => () => { + var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); - var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(s1$1); + var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(s1); return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$5$2 => { var x$5 = x$5$2 | 0; return 1 + x$5 | 0; })).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline); - })(s1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]; + }), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]; return $$x1.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("button", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); } @@ -110,25 +110,25 @@ $c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$.prototype.japgolly$ var __japgolly__hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook1_raw); - var __japgolly__hook2_raw = $i_react.useState(((props$1, __japgolly__hook1$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$().japgolly$scalajs$react$test$emissions$HooksWithScalaFns$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box(props$1, __japgolly__hook1$1))(props, __japgolly__hook1)); + var __japgolly__hook2_raw = $i_react.useState(() => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$().japgolly$scalajs$react$test$emissions$HooksWithScalaFns$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box(props, __japgolly__hook1)); var __japgolly__hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw); - var props$2 = props.a; + var props$1 = props.a; - var __japgolly__hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$2, __japgolly__hook1, __japgolly__hook2); + var __japgolly__hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, __japgolly__hook1, __japgolly__hook2); - var __japgolly__hook3_raw = $i_react.useState((__japgolly__hook3_ctx$1 => () => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$().japgolly$scalajs$react$test$emissions$HooksWithScalaFns$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box(__japgolly__hook3_ctx$1))(__japgolly__hook3_ctx)); + var __japgolly__hook3_raw = $i_react.useState(() => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$().japgolly$scalajs$react$test$emissions$HooksWithScalaFns$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box(__japgolly__hook3_ctx)); var __japgolly__hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook3_raw); - var __japgolly__hook4_raw = $i_react.useState(((props$1$1, __japgolly__hook1$1$1, __japgolly__hook2$1, __japgolly__hook3$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$().japgolly$scalajs$react$test$emissions$HooksWithScalaFns$$$anonfun$Component$5__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box(props$1$1, __japgolly__hook1$1$1, __japgolly__hook2$1, __japgolly__hook3$1))(props, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3)); + var __japgolly__hook4_raw = $i_react.useState(() => $m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$().japgolly$scalajs$react$test$emissions$HooksWithScalaFns$$$anonfun$Component$5__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_internal_Box(props, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3)); var __japgolly__hook4 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook4_raw); var this$3 = $p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__render__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_vdom_TagOf($m_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$(), props.a | 0, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3, __japgolly__hook4); return $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement.$f_Ljapgolly_scalajs_react_vdom_VdomElement__rawNode__sjs_js_$bar(this$3); -}, "CUCHactF8K3VolcNKBddVc/OdAo="); +}, "X1beusEtCU9hbnswQsd+LhtRPXk="); var $d_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$ = new $j_java$002elang$002eObject.$TypeData().initClass({ Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$: 0 }, false, "japgolly.scalajs.react.test.emissions.HooksWithScalaFns$", { diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out3.js index 94deabe93..d0de0ec9a 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/HooksWithScalaFns-out3.js @@ -18,8 +18,8 @@ import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagMod from "./japgol import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; -import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002eArray$0024 from "./scala.Array$.js"; import * as $j_scala$002eFunction1 from "./scala.Function1.js"; import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; import * as $j_scala$002escalajs$002eruntime$002eAnonFunction4 from "./scala.scalajs.runtime.AnonFunction4.js"; @@ -32,26 +32,28 @@ export { $p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__state1__I function $p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__render__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_vdom_TagOf($thiz, p, s1, s2, s3, s4) { var sum = (((p + (s1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (s2.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (s3.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (s4.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; - var this$10 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + var this$9 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); var self = "button"; - var xs = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((s1$2 => () => { + var xs = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1("Sum = ")), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); - var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(s1$2); + var r = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(s1); var ev$1 = r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$5 => { var _$5$1 = _$5 | 0; return 1 + _$5$1 | 0; })); return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(ev$1 === null ? null : ev$1.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline); - })(s1)), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)])); - return $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$10, self, xs); + }), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)])); + return $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$9, self, xs); } export { $p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__render__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_vdom_TagOf }; function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$() { + var _s = $RefreshSig$(); + this.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state2 = null; this.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state3 = null; this.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_Component = null; @@ -73,46 +75,44 @@ function $c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$() { return ((_$1$1 + (_$2$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (_$3$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0) + (_$4$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; }); - var rawComponent = (this$3$1 => { - var _s = $RefreshSig$(); + var rawComponent = props => { + _s(); - return _s(props => { - _s(); + var __japgolly__hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); - var __japgolly__hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); + var __japgolly__hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook1_raw); - var __japgolly__hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook1_raw); + var __japgolly__hook2_raw = $i_react.useState(() => { + var $$x3 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); + var p = props.a | 0; + return $$x3.apply__O__Ljapgolly_scalajs_react_internal_Box($p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__state1__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__I(this, p, __japgolly__hook1)); + }); - var __japgolly__hook2_raw = $i_react.useState(((this$2$2, props$2, __japgolly__hook1$2) => () => { - var $$x3 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); - var p = props$2.a | 0; - return $$x3.apply__O__Ljapgolly_scalajs_react_internal_Box($p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__state1__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__I(this$2$2, p, __japgolly__hook1$2)); - })(this$3$1, props, __japgolly__hook1)); + var __japgolly__hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw); - var __japgolly__hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw); + var props$1 = props.a; - var props$1 = props.a; + var __japgolly__hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, __japgolly__hook1, __japgolly__hook2); - var __japgolly__hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, __japgolly__hook1, __japgolly__hook2); + var __japgolly__hook3_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(this.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state2.apply__O__O(__japgolly__hook3_ctx))); - var __japgolly__hook3_raw = $i_react.useState(((this$3$2, __japgolly__hook3_ctx$2) => () => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(this$3$2.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state2.apply__O__O(__japgolly__hook3_ctx$2)))(this$3$1, __japgolly__hook3_ctx)); + var __japgolly__hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook3_raw); - var __japgolly__hook3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook3_raw); + var __japgolly__hook4_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(this.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state3.apply__O__O__O__O__O(props.a, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3))); - var __japgolly__hook4_raw = $i_react.useState(((this$4$1, props$3, __japgolly__hook1$3, __japgolly__hook2$2, __japgolly__hook3$2) => () => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(this$4$1.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_state3.apply__O__O__O__O__O(props$3.a, __japgolly__hook1$3, __japgolly__hook2$2, __japgolly__hook3$2)))(this$3$1, props, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3)); + var __japgolly__hook4 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook4_raw); - var __japgolly__hook4 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook4_raw); + var p$1 = props.a | 0; + var this$5 = $p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__render__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_vdom_TagOf(this, p$1, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3, __japgolly__hook4); + return this$5.rawElement__Ljapgolly_scalajs_react_facade_React$Element(); + }; - var p$1 = props.a | 0; - var this$6 = $p_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__render__I__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_vdom_TagOf(this$3$1, p$1, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3, __japgolly__hook4); - return this$6.rawElement__Ljapgolly_scalajs_react_facade_React$Element(); - }, "UNYENwiB2yOK0bLd6y904SSaSxQ="); - })(this); + _s(rawComponent, "vpNeieHdeSB/R+el2k5JlSwMbWI="); var $$x4 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); - var this$7 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var this$6 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); - this.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_Component = $$x4.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$7.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); + this.Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$__f_Component = $$x4.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$6.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); } export { $c_Ljapgolly_scalajs_react_test_emissions_HooksWithScalaFns$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseCallback-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseCallback-out2.js index 74698121d..260a5c2d0 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseCallback-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseCallback-out2.js @@ -17,8 +17,8 @@ import * as $j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024ca import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; -import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002eArray$0024 from "./scala.Array$.js"; function $c_Ljapgolly_scalajs_react_test_emissions_UseCallback$() { this.Ljapgolly_scalajs_react_test_emissions_UseCallback$__f_Component = null; @@ -45,7 +45,7 @@ $c_Ljapgolly_scalajs_react_test_emissions_UseCallback$.prototype.japgolly$scalaj var __japgolly__hook1_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$().callback__Ljapgolly_scalajs_react_util_Effect$Dispatch__Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); - var __japgolly__hook1_jscb = __japgolly__hook1_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_f$1.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline("aaaaaaaaaaaaaa", $j_java$002elang$002eCharacter$0024.$m_sci_Nil$()))); + var __japgolly__hook1_jscb = __japgolly__hook1_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_f$1.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline("aaaaaaaaaaaaaa", $j_scala$002eArray$0024.$m_sci_Nil$()))); var $$x1 = $i_react; var a = []; @@ -58,7 +58,7 @@ $c_Ljapgolly_scalajs_react_test_emissions_UseCallback$.prototype.japgolly$scalaj var __japgolly__hook2_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$().callback__Ljapgolly_scalajs_react_util_Effect$Dispatch__Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); - var __japgolly__hook2_jscb = __japgolly__hook2_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_f$1.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline("bbbbbbbbbbbbbb" + props$1, $j_java$002elang$002eCharacter$0024.$m_sci_Nil$()))); + var __japgolly__hook2_jscb = __japgolly__hook2_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_f$1.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline("bbbbbbbbbbbbbb" + props$1, $j_scala$002eArray$0024.$m_sci_Nil$()))); var $$x2 = $i_react; var a$1 = []; @@ -69,7 +69,7 @@ $c_Ljapgolly_scalajs_react_test_emissions_UseCallback$.prototype.japgolly$scalaj var __japgolly__hook3_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$().callback__Ljapgolly_scalajs_react_util_Effect$Dispatch__Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); - var __japgolly__hook3_jscb = __japgolly__hook3_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_f$1.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline("cccccccccccccc" + props.a, $j_java$002elang$002eCharacter$0024.$m_sci_Nil$()))); + var __japgolly__hook3_jscb = __japgolly__hook3_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_f$1.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline("cccccccccccccc" + props.a, $j_scala$002eArray$0024.$m_sci_Nil$()))); var $$x3 = $i_react; var a$2 = []; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseCallback-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseCallback-out3.js index da850b89c..00d31888a 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseCallback-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseCallback-out3.js @@ -14,8 +14,8 @@ import * as $j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024ca import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; -import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002eArray$0024 from "./scala.Array$.js"; import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; import * as $j_scala$002escalajs$002eruntime$002eCompat$0024 from "./scala.scalajs.runtime.Compat$.js"; @@ -31,10 +31,10 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseCallback$() { var __japgolly__hook1_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$().callback__Ljapgolly_scalajs_react_util_Effect$Dispatch__Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); var $$x1 = __japgolly__hook1_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_f$1; - var optionalParams$proxy1 = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); - var f$proxy3 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0((optionalParams$proxy1$2 => () => { - console.log("aaaaaaaaaaaaaa", ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy1$2)); - })(optionalParams$proxy1)); + var optionalParams$proxy1 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); + var f$proxy3 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + console.log("aaaaaaaaaaaaaa", ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy1)); + }); var __japgolly__hook1_jscb = $$x1.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy3)))); @@ -48,10 +48,10 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseCallback$() { var $$x2 = __japgolly__hook2_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_f$1; var message$proxy1 = "bbbbbbbbbbbbbb" + props$1; - var optionalParams$proxy2 = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); - var f$proxy6 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((message$proxy1$2, optionalParams$proxy2$2) => () => { - console.log(message$proxy1$2, ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy2$2)); - })(message$proxy1, optionalParams$proxy2)); + var optionalParams$proxy2 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); + var f$proxy6 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + console.log(message$proxy1, ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy2)); + }); var __japgolly__hook2_jscb = $$x2.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy6)))); @@ -64,10 +64,10 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseCallback$() { var $$x3 = __japgolly__hook3_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_f$1; var p = props.a | 0; var message$proxy2 = "cccccccccccccc" + p; - var optionalParams$proxy3 = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); - var f$proxy9 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((message$proxy2$2, optionalParams$proxy3$2) => () => { - console.log(message$proxy2$2, ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy3$2)); - })(message$proxy2, optionalParams$proxy3)); + var optionalParams$proxy3 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); + var f$proxy9 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + console.log(message$proxy2, ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy3)); + }); var __japgolly__hook3_jscb = $$x3.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy9)))); @@ -100,9 +100,9 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseCallback$() { _s(rawComponent, "iraUe4+KkOLn6ddQAIouaX7EXxE="); var $$x4 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); - var this$21 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var this$20 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); - this.Ljapgolly_scalajs_react_test_emissions_UseCallback$__f_Component = $$x4.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$21.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); + this.Ljapgolly_scalajs_react_test_emissions_UseCallback$__f_Component = $$x4.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$20.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); } export { $c_Ljapgolly_scalajs_react_test_emissions_UseCallback$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseEffect-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseEffect-out2.js index 2fe4d94d5..5584bdba1 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseEffect-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseEffect-out2.js @@ -14,8 +14,8 @@ import * as $j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024ca import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; -import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002eArray$0024 from "./scala.Array$.js"; function $c_Ljapgolly_scalajs_react_test_emissions_UseEffect$() { this.Ljapgolly_scalajs_react_test_emissions_UseEffect$__f_Component = null; @@ -50,28 +50,28 @@ $c_Ljapgolly_scalajs_react_test_emissions_UseEffect$.prototype.japgolly$scalajs$ var $$x3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()).apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.Ljapgolly_scalajs_react_callback_Callback$__f_empty)); var a$1 = []; $$x4.useLayoutEffect($$x3, a$1); - $i_react.useEffect($j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()).apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline(props.a, $j_java$002elang$002eCharacter$0024.$m_sci_Nil$()))), void 0); + $i_react.useEffect($j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()).apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline(props.a, $j_scala$002eArray$0024.$m_sci_Nil$()))), void 0); var $$x6 = $i_react; - var $$x5 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()).apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline(props.a, $j_java$002elang$002eCharacter$0024.$m_sci_Nil$()))); + var $$x5 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()).apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline(props.a, $j_scala$002eArray$0024.$m_sci_Nil$()))); var a$2 = []; $$x6.useEffect($$x5, a$2); - $i_react.useLayoutEffect($j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()).apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline(props.a, $j_java$002elang$002eCharacter$0024.$m_sci_Nil$()))), void 0); + $i_react.useLayoutEffect($j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()).apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline(props.a, $j_scala$002eArray$0024.$m_sci_Nil$()))), void 0); var $$x8 = $i_react; - var $$x7 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()).apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline(props.a, $j_java$002elang$002eCharacter$0024.$m_sci_Nil$()))); + var $$x7 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()).apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline(props.a, $j_scala$002eArray$0024.$m_sci_Nil$()))); var a$3 = []; $$x8.useLayoutEffect($$x7, a$3); var props$1 = props.a; - $i_react.useEffect($j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()).apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline(props$1, $j_java$002elang$002eCharacter$0024.$m_sci_Nil$()))), void 0); + $i_react.useEffect($j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()).apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline(props$1, $j_scala$002eArray$0024.$m_sci_Nil$()))), void 0); var props$2 = props.a; var $$x10 = $i_react; - var $$x9 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()).apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline(props$2, $j_java$002elang$002eCharacter$0024.$m_sci_Nil$()))); + var $$x9 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()).apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline(props$2, $j_scala$002eArray$0024.$m_sci_Nil$()))); var a$4 = []; $$x10.useEffect($$x9, a$4); var props$3 = props.a; - $i_react.useLayoutEffect($j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()).apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline(props$3, $j_java$002elang$002eCharacter$0024.$m_sci_Nil$()))), void 0); + $i_react.useLayoutEffect($j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()).apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline(props$3, $j_scala$002eArray$0024.$m_sci_Nil$()))), void 0); var props$4 = props.a; var $$x12 = $i_react; - var $$x11 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()).apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline(props$4, $j_java$002elang$002eCharacter$0024.$m_sci_Nil$()))); + var $$x11 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()).apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline(props$4, $j_scala$002eArray$0024.$m_sci_Nil$()))); var a$5 = []; $$x12.useLayoutEffect($$x11, a$5); $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseEffect-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseEffect-out3.js index 6df708777..db0794ef9 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseEffect-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseEffect-out3.js @@ -14,8 +14,8 @@ import * as $j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024ca import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; -import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002eArray$0024 from "./scala.Array$.js"; import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; import * as $j_scala$002escalajs$002eruntime$002eCompat$0024 from "./scala.scalajs.runtime.Compat$.js"; @@ -37,40 +37,40 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseEffect$() { var _$1 = props.a | 0; - var optionalParams$proxy1 = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); - var f$proxy3 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((_$1$2, optionalParams$proxy1$2) => () => { - console.log(_$1$2, ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy1$2)); - })(_$1, optionalParams$proxy1)); + var optionalParams$proxy1 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); + var f$proxy3 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + console.log(_$1, ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy1)); + }); $$x2.useEffect($$x1.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy3)))), void 0); var $$x4 = $i_react; var $$x3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); var _$2 = props.a | 0; - var optionalParams$proxy2 = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); - var f$proxy6 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((_$2$2, optionalParams$proxy2$2) => () => { - console.log(_$2$2, ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy2$2)); - })(_$2, optionalParams$proxy2)); + var optionalParams$proxy2 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); + var f$proxy6 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + console.log(_$2, ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy2)); + }); $$x4.useEffect($$x3.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy6)))), []); var $$x6 = $i_react; var $$x5 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); var _$3 = props.a | 0; - var optionalParams$proxy3 = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); - var f$proxy9 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((_$3$2, optionalParams$proxy3$2) => () => { - console.log(_$3$2, ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy3$2)); - })(_$3, optionalParams$proxy3)); + var optionalParams$proxy3 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); + var f$proxy9 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + console.log(_$3, ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy3)); + }); $$x6.useLayoutEffect($$x5.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy9)))), void 0); var $$x8 = $i_react; var $$x7 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); var _$4 = props.a | 0; - var optionalParams$proxy4 = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); - var f$proxy12 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((_$4$2, optionalParams$proxy4$2) => () => { - console.log(_$4$2, ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy4$2)); - })(_$4, optionalParams$proxy4)); + var optionalParams$proxy4 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); + var f$proxy12 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + console.log(_$4, ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy4)); + }); $$x8.useLayoutEffect($$x7.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy12)))), []); var props$1 = props.a; @@ -78,10 +78,10 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseEffect$() { var $$x10 = $i_react; var $$x9 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); - var optionalParams$proxy5 = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); - var f$proxy15 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((__japgolly__hook10_ctx$2, optionalParams$proxy5$2) => () => { - console.log(__japgolly__hook10_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props, ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy5$2)); - })(__japgolly__hook10_ctx, optionalParams$proxy5)); + var optionalParams$proxy5 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); + var f$proxy15 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + console.log(__japgolly__hook10_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props, ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy5)); + }); $$x10.useEffect($$x9.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy15)))), void 0); var props$2 = props.a; @@ -89,10 +89,10 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseEffect$() { var $$x12 = $i_react; var $$x11 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); - var optionalParams$proxy6 = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); - var f$proxy18 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((__japgolly__hook11_ctx$2, optionalParams$proxy6$2) => () => { - console.log(__japgolly__hook11_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props, ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy6$2)); - })(__japgolly__hook11_ctx, optionalParams$proxy6)); + var optionalParams$proxy6 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); + var f$proxy18 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + console.log(__japgolly__hook11_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props, ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy6)); + }); $$x12.useEffect($$x11.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy18)))), []); var props$3 = props.a; @@ -100,10 +100,10 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseEffect$() { var $$x14 = $i_react; var $$x13 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); - var optionalParams$proxy7 = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); - var f$proxy21 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((__japgolly__hook12_ctx$2, optionalParams$proxy7$2) => () => { - console.log(__japgolly__hook12_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props, ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy7$2)); - })(__japgolly__hook12_ctx, optionalParams$proxy7)); + var optionalParams$proxy7 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); + var f$proxy21 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + console.log(__japgolly__hook12_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props, ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy7)); + }); $$x14.useLayoutEffect($$x13.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy21)))), void 0); var props$4 = props.a; @@ -111,10 +111,10 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseEffect$() { var $$x16 = $i_react; var $$x15 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseEffectArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseEffectArg$().unit__Ljapgolly_scalajs_react_util_Effect$Dispatch__F1($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); - var optionalParams$proxy8 = $j_java$002elang$002eCharacter$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); - var f$proxy24 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(((__japgolly__hook13_ctx$2, optionalParams$proxy8$2) => () => { - console.log(__japgolly__hook13_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props, ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy8$2)); - })(__japgolly__hook13_ctx, optionalParams$proxy8)); + var optionalParams$proxy8 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); + var f$proxy24 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + console.log(__japgolly__hook13_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props, ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy8)); + }); $$x16.useLayoutEffect($$x15.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy24)))), []); var p = props.a | 0; return ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(p)).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; @@ -123,9 +123,9 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseEffect$() { _s(rawComponent, "k1mMCyODKidP5cenhTaO0cNn/yI="); var $$x17 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); - var this$37 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var this$36 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); - this.Ljapgolly_scalajs_react_test_emissions_UseEffect$__f_Component = $$x17.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$37.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); + this.Ljapgolly_scalajs_react_test_emissions_UseEffect$__f_Component = $$x17.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$36.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); } export { $c_Ljapgolly_scalajs_react_test_emissions_UseEffect$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseMemo-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseMemo-out2.js index 01a5d2521..354322c3d 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseMemo-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseMemo-out2.js @@ -17,9 +17,11 @@ import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 fr import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; -import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; import * as $j_scala$002eFunction1 from "./scala.Function1.js"; +import * as $j_scala$002eNone$0024 from "./scala.None$.js"; +import * as $j_scala$002eSome from "./scala.Some.js"; +import * as $j_scala$002ereflect$002eManifestFactory$0024IntManifest$0024 from "./scala.reflect.ManifestFactory$IntManifest$.js"; function $c_Ljapgolly_scalajs_react_test_emissions_UseMemo$() { this.Ljapgolly_scalajs_react_test_emissions_UseMemo$__f_Component = null; @@ -70,7 +72,7 @@ $c_Ljapgolly_scalajs_react_test_emissions_UseMemo$.prototype.japgolly$scalajs$re $c_Ljapgolly_scalajs_react_test_emissions_UseMemo$.prototype.japgolly$scalajs$react$test$emissions$UseMemo$$$anonfun$Component$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s(function (props) { _s(); - var __japgolly__hook1_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_java$002elang$002eCharacter$0024.$m_s_None$())); + var __japgolly__hook1_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eNone$0024.$m_s_None$())); var __japgolly__hook1_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook1_state_raw); @@ -81,82 +83,96 @@ $c_Ljapgolly_scalajs_react_test_emissions_UseMemo$.prototype.japgolly$scalajs$re var $$x3 = $i_react; var a = [__japgolly__hook1_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev]; - var $$x2 = $$x3.useMemo((__japgolly__hook1_deps_state$1 => () => $m_Ljapgolly_scalajs_react_test_emissions_UseMemo$().japgolly$scalajs$react$test$emissions$UseMemo$$$anonfun$Component$2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__I(__japgolly__hook1_deps_state$1))(__japgolly__hook1_deps_state), a); + var $$x2 = $$x3.useMemo(() => $m_Ljapgolly_scalajs_react_test_emissions_UseMemo$().japgolly$scalajs$react$test$emissions$UseMemo$$$anonfun$Component$2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__I(__japgolly__hook1_deps_state), a); var __japgolly__hook1_val = $$x2 | 0; var this$9 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); var a$1 = __japgolly__hook1_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev; - var evidence$2 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + $j_scala$002ereflect$002eManifestFactory$0024IntManifest$0024.$m_s_reflect_ManifestFactory$IntManifest$(); var this$8 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); var evidence$3 = this$8.by_$eq$eq__F2(); var e = new $j_japgolly$002escalajs$002ereact$002eReusability.$c_Ljapgolly_scalajs_react_Reusability(evidence$3); var r = e.Ljapgolly_scalajs_react_Reusability__f_test; - var __japgolly__hook1 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$p_Ljapgolly_scalajs_react_Reusable$__root__O__F1__Ljapgolly_scalajs_react_Reusable(this$9, a$1, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((evidence$1, reuse, a$2) => x$6$2 => { + var __japgolly__hook1 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$p_Ljapgolly_scalajs_react_Reusable$__root__O__F1__Ljapgolly_scalajs_react_Reusable(this$9, a$1, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$6$2 => { var x$6 = x$6$2; var x1 = x$6.Ljapgolly_scalajs_react_Reusable__f_japgolly$scalajs$react$Reusable$$root; if (x1 !== null) { - var o9 = evidence$1.unapply__O__s_Option(x1); + if ($j_java$002elang$002eObject.$isInt(x1)) { + var x2 = x1 | 0; + var o9 = new $j_scala$002eSome.$c_s_Some(x2); + } else { + var o9 = $j_scala$002eNone$0024.$m_s_None$(); + } + + ; if (!o9.isEmpty__Z() && o9.get__O() !== null) { - return !!reuse.apply__O__O__O(a$2, x1); + return !!r.apply__O__O__O(a$1, x1); } } ; return false; - })(evidence$2, r, a$1))).withValue__O__Ljapgolly_scalajs_react_Reusable(__japgolly__hook1_val); + })).withValue__O__Ljapgolly_scalajs_react_Reusable(__japgolly__hook1_val); - var __japgolly__hook2_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_java$002elang$002eCharacter$0024.$m_s_None$())); + var __japgolly__hook2_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eNone$0024.$m_s_None$())); var __japgolly__hook2_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_state_raw); - var this$13 = (props.a | 0) + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), __japgolly__hook1.value__O()) | 0) | 0; + var this$12 = (props.a | 0) + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), __japgolly__hook1.value__O()) | 0) | 0; - var __japgolly__hook2_deps = "" + this$13; + var __japgolly__hook2_deps = "" + this$12; var $$x4 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); - var this$15 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var this$14 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); - var __japgolly__hook2_deps_state = $$x4.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__hook2_deps, __japgolly__hook2_state, this$15.by_$eq$eq__F2()); + var __japgolly__hook2_deps_state = $$x4.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__hook2_deps, __japgolly__hook2_state, this$14.by_$eq$eq__F2()); var $$x6 = $i_react; - var a$3 = [__japgolly__hook2_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev]; - var $$x5 = $$x6.useMemo(((props$1, __japgolly__hook1$1, __japgolly__hook2_deps_state$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_UseMemo$().japgolly$scalajs$react$test$emissions$UseMemo$$$anonfun$Component$4__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_Reusable__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__I(props$1, __japgolly__hook1$1, __japgolly__hook2_deps_state$1))(props, __japgolly__hook1, __japgolly__hook2_deps_state), a$3); + var a$2 = [__japgolly__hook2_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev]; + var $$x5 = $$x6.useMemo(() => $m_Ljapgolly_scalajs_react_test_emissions_UseMemo$().japgolly$scalajs$react$test$emissions$UseMemo$$$anonfun$Component$4__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_Reusable__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__I(props, __japgolly__hook1, __japgolly__hook2_deps_state), a$2); var __japgolly__hook2_val = $$x5 | 0; - var this$23 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); - var a$4 = __japgolly__hook2_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev; - var evidence$2$1 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); - var this$22 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); - var evidence$3$1 = this$22.by_$eq$eq__F2(); + var this$22 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); + var a$3 = __japgolly__hook2_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev; + $j_scala$002ereflect$002eManifestFactory$0024IntManifest$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var this$21 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var evidence$3$1 = this$21.by_$eq$eq__F2(); var e$1 = new $j_japgolly$002escalajs$002ereact$002eReusability.$c_Ljapgolly_scalajs_react_Reusability(evidence$3$1); var r$1 = e$1.Ljapgolly_scalajs_react_Reusability__f_test; - var __japgolly__hook2 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$p_Ljapgolly_scalajs_react_Reusable$__root__O__F1__Ljapgolly_scalajs_react_Reusable(this$23, a$4, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((evidence$1$1, reuse$1, a$5) => x$6$2$1 => { + var __japgolly__hook2 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$p_Ljapgolly_scalajs_react_Reusable$__root__O__F1__Ljapgolly_scalajs_react_Reusable(this$22, a$3, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$6$2$1 => { var x$6$1 = x$6$2$1; var x1$1 = x$6$1.Ljapgolly_scalajs_react_Reusable__f_japgolly$scalajs$react$Reusable$$root; if (x1$1 !== null) { - var o9$1 = evidence$1$1.unapply__O__s_Option(x1$1); + if ($j_java$002elang$002eObject.$isInt(x1$1)) { + var x2$1 = x1$1 | 0; + var o9$1 = new $j_scala$002eSome.$c_s_Some(x2$1); + } else { + var o9$1 = $j_scala$002eNone$0024.$m_s_None$(); + } + + ; if (!o9$1.isEmpty__Z() && o9$1.get__O() !== null) { - return !!reuse$1.apply__O__O__O(a$5, x1$1); + return !!r$1.apply__O__O__O(a$3, x1$1); } } ; return false; - })(evidence$2$1, r$1, a$4))).withValue__O__Ljapgolly_scalajs_react_Reusable(__japgolly__hook2_val); + })).withValue__O__Ljapgolly_scalajs_react_Reusable(__japgolly__hook2_val); - var props$2 = props.a; + var props$1 = props.a; - var __japgolly__hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$2, __japgolly__hook1, __japgolly__hook2); + var __japgolly__hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, __japgolly__hook1, __japgolly__hook2); - var __japgolly__hook3_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_java$002elang$002eCharacter$0024.$m_s_None$())); + var __japgolly__hook3_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eNone$0024.$m_s_None$())); var __japgolly__hook3_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook3_state_raw); @@ -166,50 +182,57 @@ $c_Ljapgolly_scalajs_react_test_emissions_UseMemo$.prototype.japgolly$scalajs$re var $$x7 = r$2.value__O(); $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); var r$3 = __japgolly__hook3_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; - var this$29 = (($$x8 | 0) + ($$x7 | 0) | 0) + (r$3.value__O() | 0) | 0; + var this$27 = (($$x8 | 0) + ($$x7 | 0) | 0) + (r$3.value__O() | 0) | 0; - var __japgolly__hook3_deps = "" + this$29; + var __japgolly__hook3_deps = "" + this$27; var $$x9 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); - var this$31 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var this$29 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); - var __japgolly__hook3_deps_state = $$x9.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__hook3_deps, __japgolly__hook3_state, this$31.by_$eq$eq__F2()); + var __japgolly__hook3_deps_state = $$x9.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__hook3_deps, __japgolly__hook3_state, this$29.by_$eq$eq__F2()); var $$x11 = $i_react; - var a$6 = [__japgolly__hook3_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev]; - var $$x10 = $$x11.useMemo(((__japgolly__hook3_ctx$1, __japgolly__hook3_deps_state$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_UseMemo$().japgolly$scalajs$react$test$emissions$UseMemo$$$anonfun$Component$6__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__I(__japgolly__hook3_ctx$1, __japgolly__hook3_deps_state$1))(__japgolly__hook3_ctx, __japgolly__hook3_deps_state), a$6); + var a$4 = [__japgolly__hook3_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev]; + var $$x10 = $$x11.useMemo(() => $m_Ljapgolly_scalajs_react_test_emissions_UseMemo$().japgolly$scalajs$react$test$emissions$UseMemo$$$anonfun$Component$6__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__I(__japgolly__hook3_ctx, __japgolly__hook3_deps_state), a$4); var __japgolly__hook3_val = $$x10 | 0; - var this$39 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); - var a$7 = __japgolly__hook3_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev; - var evidence$2$2 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); - var this$38 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); - var evidence$3$2 = this$38.by_$eq$eq__F2(); + var this$37 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); + var a$5 = __japgolly__hook3_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev; + $j_scala$002ereflect$002eManifestFactory$0024IntManifest$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var this$36 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var evidence$3$2 = this$36.by_$eq$eq__F2(); var e$2 = new $j_japgolly$002escalajs$002ereact$002eReusability.$c_Ljapgolly_scalajs_react_Reusability(evidence$3$2); var r$4 = e$2.Ljapgolly_scalajs_react_Reusability__f_test; - var __japgolly__hook3 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$p_Ljapgolly_scalajs_react_Reusable$__root__O__F1__Ljapgolly_scalajs_react_Reusable(this$39, a$7, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((evidence$1$2, reuse$2, a$8) => x$6$2$2 => { + var __japgolly__hook3 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$p_Ljapgolly_scalajs_react_Reusable$__root__O__F1__Ljapgolly_scalajs_react_Reusable(this$37, a$5, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$6$2$2 => { var x$6$3 = x$6$2$2; var x1$2 = x$6$3.Ljapgolly_scalajs_react_Reusable__f_japgolly$scalajs$react$Reusable$$root; if (x1$2 !== null) { - var o9$2 = evidence$1$2.unapply__O__s_Option(x1$2); + if ($j_java$002elang$002eObject.$isInt(x1$2)) { + var x2$2 = x1$2 | 0; + var o9$2 = new $j_scala$002eSome.$c_s_Some(x2$2); + } else { + var o9$2 = $j_scala$002eNone$0024.$m_s_None$(); + } + + ; if (!o9$2.isEmpty__Z() && o9$2.get__O() !== null) { - return !!reuse$2.apply__O__O__O(a$8, x1$2); + return !!r$4.apply__O__O__O(a$5, x1$2); } } ; return false; - })(evidence$2$2, r$4, a$7))).withValue__O__Ljapgolly_scalajs_react_Reusable(__japgolly__hook3_val); + })).withValue__O__Ljapgolly_scalajs_react_Reusable(__japgolly__hook3_val); var sum = (((props.a | 0) + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), __japgolly__hook1.value__O()) | 0) | 0) + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), __japgolly__hook2.value__O()) | 0) | 0) + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), __japgolly__hook3.value__O()) | 0) | 0; $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); return new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; -}, "g/Tz7NbhIH7V0FZisW0OUW6RhXo="); +}, "J4XpZjXPN1qb/ON5Jb4ROPMKBxQ="); var $d_Ljapgolly_scalajs_react_test_emissions_UseMemo$ = new $j_java$002elang$002eObject.$TypeData().initClass({ Ljapgolly_scalajs_react_test_emissions_UseMemo$: 0 }, false, "japgolly.scalajs.react.test.emissions.UseMemo$", { diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseMemo-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseMemo-out3.js index 345d37101..859cac184 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseMemo-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseMemo-out3.js @@ -14,8 +14,8 @@ import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./ import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; -import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002eArray$0024 from "./scala.Array$.js"; import * as $j_scala$002eFunction1 from "./scala.Function1.js"; function $c_Ljapgolly_scalajs_react_test_emissions_UseMemo$() { @@ -27,7 +27,7 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseMemo$() { var rawComponent = props => { _s(); - var __japgolly__hook1_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_java$002elang$002eCharacter$0024.$m_s_None$())); + var __japgolly__hook1_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eArray$0024.$m_s_None$())); var __japgolly__hook1_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook1_state_raw); @@ -36,86 +36,100 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseMemo$() { var __japgolly__hook1_deps_state = $$x1.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState("blah", __japgolly__hook1_state, this$2.by_$eq$eq__F2()); - var __japgolly__hook1_val = $i_react.useMemo((__japgolly__hook1_deps_state$2 => () => { - var _$1$proxy1 = __japgolly__hook1_deps_state$2.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; + var __japgolly__hook1_val = $i_react.useMemo(() => { + var _$1$proxy1 = __japgolly__hook1_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; return _$1$proxy1.length | 0; - })(__japgolly__hook1_deps_state), [__japgolly__hook1_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev]) | 0; + }, [__japgolly__hook1_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev]) | 0; - var this$8 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); + var this$7 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); var a = __japgolly__hook1_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev; - var evidence$2 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); - var this$7 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); - var evidence$3 = this$7.by_$eq$eq__F2(); + $j_scala$002eArray$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var this$6 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var evidence$3 = this$6.by_$eq$eq__F2(); var e = new $j_japgolly$002escalajs$002ereact$002eReusability.$c_Ljapgolly_scalajs_react_Reusability(evidence$3); var r = e.Ljapgolly_scalajs_react_Reusability__f_test; - var __japgolly__hook1 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$p_Ljapgolly_scalajs_react_Reusable$__root__O__F1__Ljapgolly_scalajs_react_Reusable(this$8, a, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((a$2, reuse$2, evidence$1$2) => _$6 => { + var __japgolly__hook1 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$p_Ljapgolly_scalajs_react_Reusable$__root__O__F1__Ljapgolly_scalajs_react_Reusable(this$7, a, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$6 => { var _$6$1 = _$6; var x1 = _$6$1.Ljapgolly_scalajs_react_Reusable__f_root; if (x1 !== null) { - var x2 = evidence$1$2.unapply__O__s_Option(x1); + if ($j_java$002elang$002eObject.$isInt(x1)) { + var x2 = x1 | 0; + var x2$1 = new $j_scala$002eArray$0024.$c_s_Some(x2); + } else { + var x2$1 = $j_scala$002eArray$0024.$m_s_None$(); + } + + ; - if (!x2.isEmpty__Z()) { - var x3 = x2.get__O(); - return !!reuse$2.apply__O__O__O(a$2, x3); + if (!x2$1.isEmpty__Z()) { + var x3 = x2$1.get__O(); + return !!r.apply__O__O__O(a, x3); } } ; return false; - })(a, r, evidence$2))).withValue__O__Ljapgolly_scalajs_react_Reusable(__japgolly__hook1_val); + })).withValue__O__Ljapgolly_scalajs_react_Reusable(__japgolly__hook1_val); - var __japgolly__hook2_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_java$002elang$002eCharacter$0024.$m_s_None$())); + var __japgolly__hook2_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eArray$0024.$m_s_None$())); var __japgolly__hook2_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_state_raw); var p = props.a | 0; - var this$12 = p + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), __japgolly__hook1.value__O()) | 0) | 0; + var this$10 = p + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), __japgolly__hook1.value__O()) | 0) | 0; - var __japgolly__hook2_deps = "" + this$12; + var __japgolly__hook2_deps = "" + this$10; var $$x2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); - var this$14 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var this$12 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); - var __japgolly__hook2_deps_state = $$x2.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__hook2_deps, __japgolly__hook2_state, this$14.by_$eq$eq__F2()); + var __japgolly__hook2_deps_state = $$x2.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__hook2_deps, __japgolly__hook2_state, this$12.by_$eq$eq__F2()); - var __japgolly__hook2_val = $i_react.useMemo(((props$2, __japgolly__hook1$2, __japgolly__hook2_deps_state$2) => () => { - var p$1 = props$2.a | 0; - var _$2 = __japgolly__hook2_deps_state$2.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; - return ((_$2.length | 0) + p$1 | 0) + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), __japgolly__hook1$2.value__O()) | 0) | 0; - })(props, __japgolly__hook1, __japgolly__hook2_deps_state), [__japgolly__hook2_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev]) | 0; + var __japgolly__hook2_val = $i_react.useMemo(() => { + var p$1 = props.a | 0; + var _$2 = __japgolly__hook2_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; + return ((_$2.length | 0) + p$1 | 0) + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), __japgolly__hook1.value__O()) | 0) | 0; + }, [__japgolly__hook2_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev]) | 0; - var this$20 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); + var this$18 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); var a$1 = __japgolly__hook2_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev; - var evidence$2$1 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); - var this$19 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); - var evidence$3$1 = this$19.by_$eq$eq__F2(); + $j_scala$002eArray$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var this$17 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var evidence$3$1 = this$17.by_$eq$eq__F2(); var e$1 = new $j_japgolly$002escalajs$002ereact$002eReusability.$c_Ljapgolly_scalajs_react_Reusability(evidence$3$1); var r$1 = e$1.Ljapgolly_scalajs_react_Reusability__f_test; - var __japgolly__hook2 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$p_Ljapgolly_scalajs_react_Reusable$__root__O__F1__Ljapgolly_scalajs_react_Reusable(this$20, a$1, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((a$2$1, reuse$2$1, evidence$1$2$1) => _$6$2 => { + var __japgolly__hook2 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$p_Ljapgolly_scalajs_react_Reusable$__root__O__F1__Ljapgolly_scalajs_react_Reusable(this$18, a$1, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$6$2 => { var _$6$3 = _$6$2; var x1$1 = _$6$3.Ljapgolly_scalajs_react_Reusable__f_root; if (x1$1 !== null) { - var x2$1 = evidence$1$2$1.unapply__O__s_Option(x1$1); + if ($j_java$002elang$002eObject.$isInt(x1$1)) { + var x2$2 = x1$1 | 0; + var x2$3 = new $j_scala$002eArray$0024.$c_s_Some(x2$2); + } else { + var x2$3 = $j_scala$002eArray$0024.$m_s_None$(); + } - if (!x2$1.isEmpty__Z()) { - var x3$1 = x2$1.get__O(); - return !!reuse$2$1.apply__O__O__O(a$2$1, x3$1); + ; + + if (!x2$3.isEmpty__Z()) { + var x3$1 = x2$3.get__O(); + return !!r$1.apply__O__O__O(a$1, x3$1); } } ; return false; - })(a$1, r$1, evidence$2$1))).withValue__O__Ljapgolly_scalajs_react_Reusable(__japgolly__hook2_val); + })).withValue__O__Ljapgolly_scalajs_react_Reusable(__japgolly__hook2_val); var props$1 = props.a; var __japgolly__hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, __japgolly__hook1, __japgolly__hook2); - var __japgolly__hook3_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_java$002elang$002eCharacter$0024.$m_s_None$())); + var __japgolly__hook3_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eArray$0024.$m_s_None$())); var __japgolly__hook3_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook3_state_raw); @@ -125,63 +139,70 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseMemo$() { var $$x3 = r$2.value__O(); $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); var r$3 = __japgolly__hook3_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; - var this$26 = (($$x4 | 0) + ($$x3 | 0) | 0) + (r$3.value__O() | 0) | 0; + var this$23 = (($$x4 | 0) + ($$x3 | 0) | 0) + (r$3.value__O() | 0) | 0; - var __japgolly__hook3_deps = "" + this$26; + var __japgolly__hook3_deps = "" + this$23; var $$x5 = $j_japgolly$002escalajs$002ereact$002ehooks$002eCustomHook$0024.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); - var this$28 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var this$25 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); - var __japgolly__hook3_deps_state = $$x5.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__hook3_deps, __japgolly__hook3_state, this$28.by_$eq$eq__F2()); + var __japgolly__hook3_deps_state = $$x5.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__hook3_deps, __japgolly__hook3_state, this$25.by_$eq$eq__F2()); - var __japgolly__hook3_val = $i_react.useMemo(((__japgolly__hook3_ctx$2, __japgolly__hook3_deps_state$2) => () => { - var _$3$proxy1 = __japgolly__hook3_deps_state$2.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; + var __japgolly__hook3_val = $i_react.useMemo(() => { + var _$3$proxy1 = __japgolly__hook3_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; var $$x8 = _$3$proxy1.length; - var $$x7 = __japgolly__hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + var $$x7 = __japgolly__hook3_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); - var r$4 = __japgolly__hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; + var r$4 = __japgolly__hook3_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; var $$x6 = r$4.value__O(); $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); - var r$5 = __japgolly__hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; + var r$5 = __japgolly__hook3_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; return ((($$x8 | 0) + ($$x7 | 0) | 0) + ($$x6 | 0) | 0) + (r$5.value__O() | 0) | 0; - })(__japgolly__hook3_ctx, __japgolly__hook3_deps_state), [__japgolly__hook3_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev]) | 0; + }, [__japgolly__hook3_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev]) | 0; - var this$35 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); - var a$3 = __japgolly__hook3_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev; - var evidence$2$2 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); - var this$34 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); - var evidence$3$2 = this$34.by_$eq$eq__F2(); + var this$32 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(); + var a$2 = __japgolly__hook3_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev; + $j_scala$002eArray$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var this$31 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var evidence$3$2 = this$31.by_$eq$eq__F2(); var e$2 = new $j_japgolly$002escalajs$002ereact$002eReusability.$c_Ljapgolly_scalajs_react_Reusability(evidence$3$2); var r$6 = e$2.Ljapgolly_scalajs_react_Reusability__f_test; - var __japgolly__hook3 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$p_Ljapgolly_scalajs_react_Reusable$__root__O__F1__Ljapgolly_scalajs_react_Reusable(this$35, a$3, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(((a$2$2, reuse$2$2, evidence$1$2$2) => _$6$4 => { + var __japgolly__hook3 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$p_Ljapgolly_scalajs_react_Reusable$__root__O__F1__Ljapgolly_scalajs_react_Reusable(this$32, a$2, new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$6$4 => { var _$6$5 = _$6$4; var x1$2 = _$6$5.Ljapgolly_scalajs_react_Reusable__f_root; if (x1$2 !== null) { - var x2$2 = evidence$1$2$2.unapply__O__s_Option(x1$2); + if ($j_java$002elang$002eObject.$isInt(x1$2)) { + var x2$4 = x1$2 | 0; + var x2$5 = new $j_scala$002eArray$0024.$c_s_Some(x2$4); + } else { + var x2$5 = $j_scala$002eArray$0024.$m_s_None$(); + } + + ; - if (!x2$2.isEmpty__Z()) { - var x3$2 = x2$2.get__O(); - return !!reuse$2$2.apply__O__O__O(a$2$2, x3$2); + if (!x2$5.isEmpty__Z()) { + var x3$2 = x2$5.get__O(); + return !!r$6.apply__O__O__O(a$2, x3$2); } } ; return false; - })(a$3, r$6, evidence$2$2))).withValue__O__Ljapgolly_scalajs_react_Reusable(__japgolly__hook3_val); + })).withValue__O__Ljapgolly_scalajs_react_Reusable(__japgolly__hook3_val); var p$2 = props.a | 0; var sum = ((p$2 + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), __japgolly__hook1.value__O()) | 0) | 0) + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), __japgolly__hook2.value__O()) | 0) | 0) + (($j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$(), __japgolly__hook3.value__O()) | 0) | 0; return ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; }; - _s(rawComponent, "3AFql8ql6TNeaV3ZwsAY8AahdS4="); + _s(rawComponent, "B9FCBR48dreDSEq0T/BcBc3hpN0="); var $$x9 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); - var this$43 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var this$39 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); - this.Ljapgolly_scalajs_react_test_emissions_UseMemo$__f_Component = $$x9.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$43.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); + this.Ljapgolly_scalajs_react_test_emissions_UseMemo$__f_Component = $$x9.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$39.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); } export { $c_Ljapgolly_scalajs_react_test_emissions_UseMemo$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseRef-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseRef-out2.js index 3960a5758..fd0ca5160 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseRef-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseRef-out2.js @@ -23,10 +23,10 @@ import * as $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024 f import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; -import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; import * as $j_org$002escalajs$002edom$002eHTMLInputElement from "./org.scalajs.dom.HTMLInputElement.js"; import * as $j_scala$002eFunction1 from "./scala.Function1.js"; +import * as $j_scala$002ereflect$002eClassTag$0024GenericClassTag from "./scala.reflect.ClassTag$GenericClassTag.js"; function $c_Ljapgolly_scalajs_react_test_emissions_UseRef$() { this.Ljapgolly_scalajs_react_test_emissions_UseRef$__f_jsComp = null; @@ -81,7 +81,7 @@ $c_Ljapgolly_scalajs_react_test_emissions_UseRef$.prototype.japgolly$scalajs$rea var __japgolly__hook4_raw = $i_react.useRef(null); var this$9 = $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook4_raw); - var ct = new $j_java$002elang$002eCharacter$0024.$c_s_reflect_ClassTag$GenericClassTag($j_org$002escalajs$002edom$002eHTMLInputElement.$d_Lorg_scalajs_dom_HTMLInputElement.getClassOf()); + var ct = new $j_scala$002ereflect$002eClassTag$0024GenericClassTag.$c_s_reflect_ClassTag$GenericClassTag($j_org$002escalajs$002edom$002eHTMLInputElement.$d_Lorg_scalajs_dom_HTMLInputElement.getClassOf()); $j_japgolly$002escalajs$002ereact$002eRef$0024FullF.$f_Ljapgolly_scalajs_react_Ref$FullF__narrowOption__s_reflect_ClassTag__Ljapgolly_scalajs_react_Ref$FullF(this$9, ct); var __japgolly__hook5_raw = $i_react.useRef(null); diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseRef-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseRef-out3.js index 7799ce790..57a29d593 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseRef-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseRef-out3.js @@ -22,13 +22,15 @@ import * as $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024 f import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; -import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; import * as $j_org$002escalajs$002edom$002eHTMLInputElement from "./org.scalajs.dom.HTMLInputElement.js"; +import * as $j_scala$002eArray$0024 from "./scala.Array$.js"; import * as $j_scala$002eConversion from "./scala.Conversion.js"; import * as $j_scala$002eFunction1 from "./scala.Function1.js"; function $c_Ljapgolly_scalajs_react_test_emissions_UseRef$() { + var _s = $RefreshSig$(); + this.Ljapgolly_scalajs_react_test_emissions_UseRef$__f_jsComp = null; this.Ljapgolly_scalajs_react_test_emissions_UseRef$__f_scalaComp = null; this.Ljapgolly_scalajs_react_test_emissions_UseRef$__f_Component = null; @@ -42,73 +44,71 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseRef$() { return x$2; })).build__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot($j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null)); - var rawComponent = (this$2$1 => { - var _s = $RefreshSig$(); + var rawComponent = props => { + _s(); - return _s(props => { - _s(); + var __japgolly__hook1_raw = $i_react.useRef(100); - var __japgolly__hook1_raw = $i_react.useRef(100); + var this$6 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); + new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseRefF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseRefF(__japgolly__hook1_raw, this$6.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + var $$x1 = $i_react; + var p = props.a | 0; - var this$6 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); - new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseRefF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseRefF(__japgolly__hook1_raw, this$6.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); - var $$x1 = $i_react; - var p = props.a | 0; + var __japgolly__hook2_raw = $$x1.useRef(p); - var __japgolly__hook2_raw = $$x1.useRef(p); + var this$8 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); + new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseRefF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseRefF(__japgolly__hook2_raw, this$8.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + var props$1 = props.a; - var this$8 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); - new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseRefF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseRefF(__japgolly__hook2_raw, this$8.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); - var props$1 = props.a; + var __japgolly__hook3_raw = $i_react.useRef(props$1); - var __japgolly__hook3_raw = $i_react.useRef(props$1); + var this$11 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); + new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseRefF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseRefF(__japgolly__hook3_raw, this$11.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); - var this$11 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); - new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseRefF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseRefF(__japgolly__hook3_raw, this$11.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + var __japgolly__hook4_raw = $i_react.useRef(null); - var __japgolly__hook4_raw = $i_react.useRef(null); + var this$13 = $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook4_raw); + var ct = new $j_scala$002eArray$0024.$c_s_reflect_ClassTag$GenericClassTag($j_org$002escalajs$002edom$002eHTMLInputElement.$d_Lorg_scalajs_dom_HTMLInputElement.getClassOf()); + $j_japgolly$002escalajs$002ereact$002eRef$0024FullF.$f_Ljapgolly_scalajs_react_Ref$FullF__narrowOption__s_reflect_ClassTag__Ljapgolly_scalajs_react_Ref$FullF(this$13, ct); - var this$13 = $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook4_raw); - var ct = new $j_java$002elang$002eCharacter$0024.$c_s_reflect_ClassTag$GenericClassTag($j_org$002escalajs$002edom$002eHTMLInputElement.$d_Lorg_scalajs_dom_HTMLInputElement.getClassOf()); - $j_japgolly$002escalajs$002ereact$002eRef$0024FullF.$f_Ljapgolly_scalajs_react_Ref$FullF__narrowOption__s_reflect_ClassTag__Ljapgolly_scalajs_react_Ref$FullF(this$13, ct); + var __japgolly__hook5_raw = $i_react.useRef(null); - var __japgolly__hook5_raw = $i_react.useRef(null); + $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook5_raw); - $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook5_raw); + var __japgolly__hook6_raw = $i_react.useRef(null); - var __japgolly__hook6_raw = $i_react.useRef(null); + $j_japgolly$002escalajs$002ereact$002ehooks$002eAbstractHookMacros$0024.$m_Ljapgolly_scalajs_react_hooks_AbstractHookMacros$().helperRefToJsComponent__Ljapgolly_scalajs_react_Ref$FullF__F1__Ljapgolly_scalajs_react_Ref$ToComponentF($j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook6_raw), $j_japgolly$002escalajs$002ereact$002eRef$0024WithJsComponentArg$0024.$m_Ljapgolly_scalajs_react_Ref$WithJsComponentArg$().effectId__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__F1(this.Ljapgolly_scalajs_react_test_emissions_UseRef$__f_jsComp)); - $j_japgolly$002escalajs$002ereact$002ehooks$002eAbstractHookMacros$0024.$m_Ljapgolly_scalajs_react_hooks_AbstractHookMacros$().helperRefToJsComponent__Ljapgolly_scalajs_react_Ref$FullF__F1__Ljapgolly_scalajs_react_Ref$ToComponentF($j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook6_raw), $j_japgolly$002escalajs$002ereact$002eRef$0024WithJsComponentArg$0024.$m_Ljapgolly_scalajs_react_Ref$WithJsComponentArg$().effectId__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__F1(this$2$1.Ljapgolly_scalajs_react_test_emissions_UseRef$__f_jsComp)); + var __japgolly__hook7_raw = $i_react.useRef(null); - var __japgolly__hook7_raw = $i_react.useRef(null); + $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook7_raw).map__F1__Ljapgolly_scalajs_react_Ref$FullF(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$20 => new $j_japgolly$002escalajs$002ereact$002ecomponent$002eJs$0024$0024anon$00243.$c_Ljapgolly_scalajs_react_component_Js$$anon$3(_$20))); - $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook7_raw).map__F1__Ljapgolly_scalajs_react_Ref$FullF(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$20 => new $j_japgolly$002escalajs$002ereact$002ecomponent$002eJs$0024$0024anon$00243.$c_Ljapgolly_scalajs_react_component_Js$$anon$3(_$20))); + var __japgolly__hook8_raw = $i_react.useRef(null); - var __japgolly__hook8_raw = $i_react.useRef(null); + $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook8_raw).map__F1__Ljapgolly_scalajs_react_Ref$FullF(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$21 => { + var this$16 = new $j_japgolly$002escalajs$002ereact$002ecomponent$002eJs$0024$0024anon$00243.$c_Ljapgolly_scalajs_react_component_Js$$anon$3(_$21); + return this$16; + })); - $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook8_raw).map__F1__Ljapgolly_scalajs_react_Ref$FullF(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$21 => { - var this$17 = new $j_japgolly$002escalajs$002ereact$002ecomponent$002eJs$0024$0024anon$00243.$c_Ljapgolly_scalajs_react_component_Js$$anon$3(_$21); - return this$17; - })); + var __japgolly__hook9_raw = $i_react.useRef(null); - var __japgolly__hook9_raw = $i_react.useRef(null); + var c = this.Ljapgolly_scalajs_react_test_emissions_UseRef$__f_scalaComp; + var r = $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook9_raw).map__F1__Ljapgolly_scalajs_react_Ref$FullF(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$22 => _$22.mountedImpure)); + $j_japgolly$002escalajs$002ereact$002eRef$0024ToComponent$0024.$m_Ljapgolly_scalajs_react_Ref$ToComponent$().inject__Ljapgolly_scalajs_react_CtorType__Ljapgolly_scalajs_react_Ref$FullF__Ljapgolly_scalajs_react_Ref$ToComponentF(c.ctor__Ljapgolly_scalajs_react_CtorType(), r); - var c = this$2$1.Ljapgolly_scalajs_react_test_emissions_UseRef$__f_scalaComp; - var r = $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook9_raw).map__F1__Ljapgolly_scalajs_react_Ref$FullF(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$22 => _$22.mountedImpure)); - $j_japgolly$002escalajs$002ereact$002eRef$0024ToComponent$0024.$m_Ljapgolly_scalajs_react_Ref$ToComponent$().inject__Ljapgolly_scalajs_react_CtorType__Ljapgolly_scalajs_react_Ref$FullF__Ljapgolly_scalajs_react_Ref$ToComponentF(c.ctor__Ljapgolly_scalajs_react_CtorType(), r); + var __japgolly__hook10_raw = $i_react.useRef(null); - var __japgolly__hook10_raw = $i_react.useRef(null); + $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook10_raw).map__F1__Ljapgolly_scalajs_react_Ref$FullF(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$22$2 => _$22$2.mountedImpure)); + props.a; + return ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(123)).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; + }; - $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook10_raw).map__F1__Ljapgolly_scalajs_react_Ref$FullF(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$22$2 => _$22$2.mountedImpure)); - props.a; - return ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(123)).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; - }, "4YAVp10giPdDWy5crWN+hQ8h7yo="); - })(this); + _s(rawComponent, "4YAVp10giPdDWy5crWN+hQ8h7yo="); var $$x2 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); - var this$23 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var this$22 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); - this.Ljapgolly_scalajs_react_test_emissions_UseRef$__f_Component = $$x2.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$23.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); + this.Ljapgolly_scalajs_react_test_emissions_UseRef$__f_Component = $$x2.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$22.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); } export { $c_Ljapgolly_scalajs_react_test_emissions_UseRef$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out2.js index 739fbf6a2..22a3f7e58 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out2.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out2.js @@ -17,8 +17,8 @@ import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 fr import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; -import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002ereflect$002eManifestFactory$0024IntManifest$0024 from "./scala.reflect.ManifestFactory$IntManifest$.js"; function $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$() { this.Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$__f_Component = null; @@ -69,33 +69,33 @@ $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$.prototype.japgolly$ var this$2 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); var r = this$2.by_$eq$eq__F2(); - var ct = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var ct = $j_scala$002ereflect$002eManifestFactory$0024IntManifest$0024.$m_s_reflect_ManifestFactory$IntManifest$(); var rr = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r); var this$6 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook1_raw); var us = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$6, r); var __japgolly__hook1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us, rr, ct); - var __japgolly__hook2_raw = $i_react.useState(((props$1, __japgolly__hook1$1) => () => $m_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$().japgolly$scalajs$react$test$emissions$UseStateWithReuse$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__Ljapgolly_scalajs_react_internal_Box(props$1, __japgolly__hook1$1))(props, __japgolly__hook1)); + var __japgolly__hook2_raw = $i_react.useState(() => $m_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$().japgolly$scalajs$react$test$emissions$UseStateWithReuse$$$anonfun$Component$3__Ljapgolly_scalajs_react_internal_Box__Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__Ljapgolly_scalajs_react_internal_Box(props, __japgolly__hook1)); var this$7 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); var r$1 = this$7.by_$eq$eq__F2(); - var ct$1 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var ct$1 = $j_scala$002ereflect$002eManifestFactory$0024IntManifest$0024.$m_s_reflect_ManifestFactory$IntManifest$(); var rr$1 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r$1); var this$11 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw); var us$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$11, r$1); var __japgolly__hook2 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us$1, rr$1, ct$1); - var props$2 = props.a; + var props$1 = props.a; - var __japgolly__hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$2, __japgolly__hook1, __japgolly__hook2); + var __japgolly__hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, __japgolly__hook1, __japgolly__hook2); - var __japgolly__hook3_raw = $i_react.useState((__japgolly__hook3_ctx$1 => () => $m_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$().japgolly$scalajs$react$test$emissions$UseStateWithReuse$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box(__japgolly__hook3_ctx$1))(__japgolly__hook3_ctx)); + var __japgolly__hook3_raw = $i_react.useState(() => $m_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$().japgolly$scalajs$react$test$emissions$UseStateWithReuse$$$anonfun$Component$4__Ljapgolly_scalajs_react_hooks_HookCtx$P2__Ljapgolly_scalajs_react_internal_Box(__japgolly__hook3_ctx)); var this$13 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); var r$2 = this$13.by_$eq$eq__F2(); - var ct$2 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var ct$2 = $j_scala$002ereflect$002eManifestFactory$0024IntManifest$0024.$m_s_reflect_ManifestFactory$IntManifest$(); var rr$2 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r$2); var this$17 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook3_raw); var us$2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$17, r$2); @@ -112,7 +112,7 @@ $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$.prototype.japgolly$ $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); return new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; -}, "RC9RF3UJUzTJNDHyeyY8zVbAzz0="); +}, "Xkkr0EQe1HWs2USGiA0+nJEiGtA="); var $d_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$ = new $j_java$002elang$002eObject.$TypeData().initClass({ Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$: 0 }, false, "japgolly.scalajs.react.test.emissions.UseStateWithReuse$", { diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out3.js index 4cd4e9c90..f68930184 100644 --- a/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out3.js +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/UseStateWithReuse-out3.js @@ -14,8 +14,8 @@ import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./ import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; -import * as $j_java$002elang$002eCharacter$0024 from "./java.lang.Character$.js"; import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_scala$002eArray$0024 from "./scala.Array$.js"; function $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$() { var _s = $RefreshSig$(); @@ -28,28 +28,28 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$() { var __japgolly__hook1_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(123)); - var this$3 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); - var r = this$3.by_$eq$eq__F2(); - var ct = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var this$2 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var r = this$2.by_$eq$eq__F2(); + var ct = $j_scala$002eArray$0024.$m_s_reflect_ManifestFactory$IntManifest$(); var rr = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r); - var this$8 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook1_raw); - var us = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$8, r); + var this$7 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook1_raw); + var us = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$7, r); var __japgolly__hook1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us, rr, ct); - var __japgolly__hook2_raw = $i_react.useState(((props$2, __japgolly__hook1$2) => () => { + var __japgolly__hook2_raw = $i_react.useState(() => { var $$x1 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); - var p = props$2.a | 0; - var this$10 = __japgolly__hook1$2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - return $$x1.apply__O__Ljapgolly_scalajs_react_internal_Box(p + (this$10.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0); - })(props, __japgolly__hook1)); - - var this$11 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); - var r$1 = this$11.by_$eq$eq__F2(); - var ct$1 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var p = props.a | 0; + var this$9 = __japgolly__hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + return $$x1.apply__O__Ljapgolly_scalajs_react_internal_Box(p + (this$9.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0); + }); + + var this$10 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var r$1 = this$10.by_$eq$eq__F2(); + var ct$1 = $j_scala$002eArray$0024.$m_s_reflect_ManifestFactory$IntManifest$(); var rr$1 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r$1); - var this$16 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw); - var us$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$16, r$1); + var this$15 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw); + var us$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$15, r$1); var __japgolly__hook2 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us$1, rr$1, ct$1); @@ -57,42 +57,42 @@ function $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$() { var __japgolly__hook3_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, __japgolly__hook1, __japgolly__hook2); - var __japgolly__hook3_raw = $i_react.useState((__japgolly__hook3_ctx$2 => () => { + var __japgolly__hook3_raw = $i_react.useState(() => { var $$x4 = $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$(); - var $$x3 = __japgolly__hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; - var this$19 = __japgolly__hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; - var this$20 = this$19.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - var $$x2 = this$20.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; - var this$21 = __japgolly__hook3_ctx$2.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; - var this$22 = this$21.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - return $$x4.apply__O__Ljapgolly_scalajs_react_internal_Box((($$x3 | 0) + ($$x2 | 0) | 0) + (this$22.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0); - })(__japgolly__hook3_ctx)); - - var this$23 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); - var r$2 = this$23.by_$eq$eq__F2(); - var ct$2 = $j_java$002elang$002eCharacter$0024.$m_s_reflect_ManifestFactory$IntManifest$(); + var $$x3 = __japgolly__hook3_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P0__f_props; + var this$18 = __japgolly__hook3_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; + var this$19 = this$18.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var $$x2 = this$19.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; + var this$20 = __japgolly__hook3_ctx.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; + var this$21 = this$20.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + return $$x4.apply__O__Ljapgolly_scalajs_react_internal_Box((($$x3 | 0) + ($$x2 | 0) | 0) + (this$21.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0); + }); + + var this$22 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var r$2 = this$22.by_$eq$eq__F2(); + var ct$2 = $j_scala$002eArray$0024.$m_s_reflect_ManifestFactory$IntManifest$(); var rr$2 = $j_japgolly$002escalajs$002ereact$002eReusable$0024.$m_Ljapgolly_scalajs_react_Reusable$().reusabilityInstance__F2__Ljapgolly_scalajs_react_Reusable(r$2); - var this$28 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook3_raw); - var us$2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$28, r$2); + var this$27 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook3_raw); + var us$2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__withReusability__F2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(this$27, r$2); var __japgolly__hook3 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateWithReuseF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF(us$2, rr$2, ct$2); props.a; - var this$31 = __japgolly__hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - var $$x6 = this$31.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; - var this$32 = __japgolly__hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - var $$x5 = this$32.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; - var this$33 = __japgolly__hook3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; - var sum = (($$x6 | 0) + ($$x5 | 0) | 0) + (this$33.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; + var this$30 = __japgolly__hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var $$x6 = this$30.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; + var this$31 = __japgolly__hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var $$x5 = this$31.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; + var this$32 = __japgolly__hook3.Ljapgolly_scalajs_react_hooks_Hooks$UseStateWithReuseF__f_withoutReuse; + var sum = (($$x6 | 0) + ($$x5 | 0) | 0) + (this$32.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0] | 0) | 0; return ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(sum)).Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1__f_n$1; }; - _s(rawComponent, "DstOFN78pFHm3XD0J31WCO1Go4A="); + _s(rawComponent, "b1UXCkgOshr0vZNsvKdc+rQU/BM="); var $$x7 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); - var this$36 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var this$35 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); - this.Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$__f_Component = $$x7.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$36.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); + this.Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$__f_Component = $$x7.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$35.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); } export { $c_Ljapgolly_scalajs_react_test_emissions_UseStateWithReuse$ }; From ad7b116b70d15be804e05d53dec33a0d8f7d45e9 Mon Sep 17 00:00:00 2001 From: David Barri Date: Mon, 27 Jun 2022 12:34:26 +1000 Subject: [PATCH 71/72] Add placeholder implementations for renderRR with reuse --- .../react/hooks/HookMacrosTraits.scala | 29 ++++- .../react/hooks/HookMacrosTraits.scala | 29 ++++- .../scalajs/react/core/HooksRRTest.scala | 100 ++++++++++++++++-- 3 files changed, 146 insertions(+), 12 deletions(-) diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacrosTraits.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacrosTraits.scala index cf8a1301a..c86a837c1 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacrosTraits.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacrosTraits.scala @@ -4,7 +4,7 @@ import japgolly.scalajs.react.component.ScalaFn.Component import japgolly.scalajs.react.hooks.Api._ import japgolly.scalajs.react.internal.Box import japgolly.scalajs.react.vdom.VdomNode -import japgolly.scalajs.react.{Children, CtorType, PropsChildren} +import japgolly.scalajs.react.{Children, CtorType, PropsChildren, Reusable, Reusability} trait ApiPrimaryWithRenderMacros[P, C <: Children, Ctx, Step <: AbstractStep] { self: PrimaryWithRender[P, C, Ctx, Step] => @@ -14,6 +14,15 @@ trait ApiPrimaryWithRenderMacros[P, C <: Children, Ctx, Step <: AbstractStep] { final def renderRRDebug(f: Ctx => VdomNode)(implicit s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = macro HookMacros.renderDebug1[P, C] + + final def renderRRReusable[A](f: Ctx => Reusable[A])(implicit s: CtorType.Summoner[Box[P], C], v: A => VdomNode): Component[P, s.CT] = + renderReusable(f) // TODO: use macro + + final def renderRRWithReuse(f: Ctx => VdomNode)(implicit s: CtorType.Summoner[Box[P], C], r: Reusability[Ctx]): Component[P, s.CT] = + renderWithReuse(f) // TODO: use macro + + final def renderRRWithReuseBy[A](reusableInputs: Ctx => A)(f: A => VdomNode)(implicit s: CtorType.Summoner[Box[P], C], r: Reusability[A]): Component[P, s.CT] = + renderWithReuseBy(reusableInputs)(f) // TODO: use macro } // ===================================================================================================================== @@ -26,6 +35,15 @@ trait ComponentPCMacros[P] { final def renderRRDebug(f: (P, PropsChildren) => VdomNode)(implicit s: CtorType.Summoner[Box[P], Children.Varargs]): Component[P, s.CT] = macro HookMacros.renderDebugC1[P] + + final def renderRRReusable[A](f: (P, PropsChildren) => Reusable[A])(implicit s: CtorType.Summoner[Box[P], Children.Varargs], v: A => VdomNode): Component[P, s.CT] = + renderReusable(f) // TODO: use macro + + final def renderRRWithReuse(f: (P, PropsChildren) => VdomNode)(implicit s: CtorType.Summoner[Box[P], Children.Varargs], r: Reusability[Ctx]): Component[P, s.CT] = + renderWithReuse(f) // TODO: use macro + + final def renderRRWithReuseBy[A](reusableInputs: (P, PropsChildren) => A)(f: A => VdomNode)(implicit s: CtorType.Summoner[Box[P], Children.Varargs], r: Reusability[A]): Component[P, s.CT] = + renderWithReuseBy(reusableInputs)(f) // TODO: use macro } // ===================================================================================================================== @@ -38,4 +56,13 @@ trait ApiSecondaryWithRenderMacros[P, C <: Children, Ctx, CtxFn[_], Step <: Subs final def renderRRDebug(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = macro HookMacros.renderDebug2[P, C, Ctx, CtxFn, Step] + + final def renderRRReusable[A](f: CtxFn[Reusable[A]])(implicit step: Step, s: CtorType.Summoner[Box[P], C], v: A => VdomNode): Component[P, s.CT] = + renderReusable(step.squash(f)(_)) // TODO: use macro + + final def renderRRWithReuse(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C], r: Reusability[Ctx]): Component[P, s.CT] = + renderWithReuse(step.squash(f)(_)) // TODO: use macro + + final def renderRRWithReuseBy[A](reusableInputs: CtxFn[A])(f: A => VdomNode)(implicit step: Step, s: CtorType.Summoner[Box[P], C], r: Reusability[A]): Component[P, s.CT] = + renderWithReuseBy(step.squash(reusableInputs)(_))(f) // TODO: use macro } diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala index 4537f1892..629d3b1f4 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala @@ -1,7 +1,6 @@ package japgolly.scalajs.react.hooks import japgolly.microlibs.compiletime.MacroEnv.* -import japgolly.scalajs.react.{Children, CtorType, PropsChildren, Reusability} import japgolly.scalajs.react.component.{JsFn, ScalaFn} import japgolly.scalajs.react.component.ScalaFn.Component import japgolly.scalajs.react.facade @@ -10,6 +9,7 @@ import japgolly.scalajs.react.hooks.Api.* import japgolly.scalajs.react.hooks.HookCtx import japgolly.scalajs.react.internal.{Box, MacroLogger} import japgolly.scalajs.react.vdom.VdomNode +import japgolly.scalajs.react.{Children, CtorType, PropsChildren, Reusable, Reusability} import scala.annotation._ import scala.quoted.* import scala.reflect.ClassTag @@ -27,6 +27,15 @@ object ApiPrimaryWithRenderMacros { inline def renderRRDebug(inline f: Ctx => VdomNode)(implicit inline s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = HookMacros.renderDebug1Workaround[P, C, Ctx, Step, s.CT](self, f, s) + + inline def renderRRReusable[A](f: Ctx => Reusable[A])(implicit s: CtorType.Summoner[Box[P], C], v: A => VdomNode): Component[P, s.CT] = + renderReusable(f) // TODO: use macro + + inline def renderRRWithReuse(f: Ctx => VdomNode)(implicit s: CtorType.Summoner[Box[P], C], r: Reusability[Ctx]): Component[P, s.CT] = + renderWithReuse(f) // TODO: use macro + + inline def renderRRWithReuseBy[A](reusableInputs: Ctx => A)(f: A => VdomNode)(implicit s: CtorType.Summoner[Box[P], C], r: Reusability[A]): Component[P, s.CT] = + renderWithReuseBy(reusableInputs)(f) // TODO: use macro } } @@ -45,6 +54,15 @@ object ComponentPCMacros { inline def renderRRDebug(inline f: (P, PropsChildren) => VdomNode)(implicit inline s: CtorType.Summoner[Box[P], Children.Varargs]): Component[P, s.CT] = HookMacros.renderDebugC1Workaround[P, s.CT](self, f, s) + + inline def renderRRReusable[A](f: (P, PropsChildren) => Reusable[A])(implicit s: CtorType.Summoner[Box[P], Children.Varargs], v: A => VdomNode): Component[P, s.CT] = + renderReusable(f) // TODO: use macro + + inline def renderRRWithReuse(f: (P, PropsChildren) => VdomNode)(implicit s: CtorType.Summoner[Box[P], Children.Varargs], r: Reusability[Ctx]): Component[P, s.CT] = + renderWithReuse(f) // TODO: use macro + + inline def renderRRWithReuseBy[A](reusableInputs: (P, PropsChildren) => A)(f: A => VdomNode)(implicit s: CtorType.Summoner[Box[P], Children.Varargs], r: Reusability[A]): Component[P, s.CT] = + renderWithReuseBy(reusableInputs)(f) // TODO: use macro } } @@ -71,5 +89,14 @@ object ApiSecondaryWithRenderMacros { inline def renderRRDebug(inline f: Ctx => VdomNode)(implicit inline s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = HookMacros.renderDebug1Workaround[P, C, Ctx, Step, s.CT](self, f, s) + + inline def renderRRReusable[A](f: CtxFn[Reusable[A]])(implicit step: Step, s: CtorType.Summoner[Box[P], C], v: A => VdomNode): Component[P, s.CT] = + renderReusable(step.squash(f)(_)) // TODO: use macro + + inline def renderRRWithReuse(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C], r: Reusability[Ctx]): Component[P, s.CT] = + renderWithReuse(step.squash(f)(_)) // TODO: use macro + + inline def renderRRWithReuseBy[A](reusableInputs: CtxFn[A])(f: A => VdomNode)(implicit step: Step, s: CtorType.Summoner[Box[P], C], r: Reusability[A]): Component[P, s.CT] = + renderWithReuseBy(step.squash(reusableInputs)(_))(f) // TODO: use macro } } diff --git a/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksRRTest.scala b/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksRRTest.scala index 9575ec901..b51831202 100644 --- a/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksRRTest.scala +++ b/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksRRTest.scala @@ -1187,7 +1187,7 @@ object HooksRRTest extends TestSuite { .useState(20) .useCallback(Callback(extState += 1)) .useForceUpdate - .renderWithReuse { (p, s, incES, fu) => + .renderRRWithReuse { (p, s, incES, fu) => renders += 1 <.div( s"P=$p, S=${s.value}, ES=$extState, R=$renders", @@ -1216,7 +1216,7 @@ object HooksRRTest extends TestSuite { implicit val reusability: Reusability[PI] = Reusability.never var renders = 0 val comp = ScalaFnComponent.withHooks[PI] - .renderWithReuse { p => + .renderRRWithReuse { p => renders += 1 <.div(s"P=$p, R=$renders") } @@ -1240,11 +1240,46 @@ object HooksRRTest extends TestSuite { } } + private def testRenderWithReuseNeverPC(): Unit = { + implicit val reusability: Reusability[PI] = Reusability.never + + implicit val v: Reusability[japgolly.scalajs.react.hooks.HookCtx.PC0[PI]] = + japgolly.scalajs.react.hooks.HookCtx.reusabilityPC0 + + var renders = 0 + val comp = ScalaFnComponent.withHooks[PI] + .withPropsChildren + .renderRRWithReuse { (p, c) => + renders += 1 + <.div(s"P=$p, R=$renders", c) + } + + val wrapper = ScalaComponent.builder[PI] + .initialStateFromProps(identity) + .renderS { ($, s) => + <.div( + comp(s)("."), + <.button(^.onClick --> $.modState(_ + 0)), + <.button(^.onClick --> $.modState(_ + 1)), + ) + } + .build + + withRenderedIntoBody(wrapper(PI(3))) { (_, root) => + val t = new DomTester(root) + t.assertText("P=PI(3), R=1.") + t.clickButton(2); t.assertText("P=PI(4), R=2.") + t.clickButton(1); t.assertText("P=PI(4), R=3.") + } + } + private def testRenderWithReuseAndUseRef(): Unit = { val comp = ScalaFnComponent.withHooks[Unit] .useRef(100) .useState(0) - .renderWithReuse { (_, ref, s) => + .renderRRWithReuse { $ => + val ref = $.hook1 + val s = $.hook2 <.div( ref.value, <.button(^.onClick --> ref.mod(_ + 1)), @@ -1264,9 +1299,10 @@ object HooksRRTest extends TestSuite { private def testRenderWithReuseAndUseRefToVdom(): Unit = { var text = "uninitialised" val comp = ScalaFnComponent.withHooks[Unit] + .withPropsChildren .useRefToVdom[Input] .useState("x") - .renderWithReuse { (_, inputRef, s) => + .renderRRWithReuse { (_, c, inputRef, s) => def onChange(e: ReactEventFromInput): Callback = s.setState(e.target.value) @@ -1281,11 +1317,53 @@ object HooksRRTest extends TestSuite { <.div( <.input.text.withRef(inputRef)(^.value := s.value, ^.onChange ==> onChange), - <.button(^.onClick --> btn) + <.button(^.onClick --> btn), + c ) } - test(comp()) { t => + test(comp("!")) { t => + t.assertInputText("x") + t.clickButton() + assertEq(text, "x") + + t.setInputText("hehe") + t.assertInputText("hehe") + t.clickButton() + assertEq(text, "hehe") + } + } + + private def testRenderWithReuseAndUseRefToVdomO(): Unit = { + var text = "uninitialised" + val comp = ScalaFnComponent.withHooks[Unit] + .withPropsChildren + .useRefToVdom[Input] + .useState("x") + .renderRRWithReuse { $ => + val c = $.propsChildren + val inputRef = $.hook1 + val s = $.hook2 + + def onChange(e: ReactEventFromInput): Callback = + s.setState(e.target.value) + + def btn: Callback = + for { + i <- inputRef.get.asCBO + // _ <- Callback.log(s"i.value = [${i.value}]") + } yield { + text = i.value + } + + <.div( + <.input.text.withRef(inputRef)(^.value := s.value, ^.onChange ==> onChange), + <.button(^.onClick --> btn), + c + ) + } + + test(comp("!")) { t => t.assertInputText("x") t.clickButton() assertEq(text, "x") @@ -1431,10 +1509,12 @@ object HooksRRTest extends TestSuite { } "renderWithReuse" - { - "main" - testRenderWithReuse() - "never" - testRenderWithReuseNever() - "useRef" - testRenderWithReuseAndUseRef() - "useRefToVdom" - testRenderWithReuseAndUseRefToVdom() + "main" - testRenderWithReuse() // P, Secondary, CtxFn + "never" - testRenderWithReuseNever() // P, Primary + "neverC" - testRenderWithReuseNeverPC() // PC, Primary + "useRef" - testRenderWithReuseAndUseRef() // P, Secondary, CtxObj + "useRefToVdom" - testRenderWithReuseAndUseRefToVdom() // PC, Secondary, CtxFn + "useRefToVdomO" - testRenderWithReuseAndUseRefToVdomO() // PC, Secondary, CtxObj } } } From 3a428e3fab487588de7ea81c5e691ee62e53da28 Mon Sep 17 00:00:00 2001 From: David Barri Date: Tue, 28 Jun 2022 14:57:27 +1000 Subject: [PATCH 72/72] Support RR in `render{Reusable,WithReuse,WithReuseBy}` --- library/TODO.md | 13 - .../scalajs/react/hooks/HookMacros.scala | 253 +++++-- .../react/hooks/HookMacrosTraits.scala | 49 +- .../scalajs/react/hooks/HookMacros.scala | 694 +++++++++++++++--- .../react/hooks/HookMacrosTraits.scala | 99 ++- .../react/hooks/AbstractHookMacros.scala | 326 ++++++-- .../scalajs/react/test/emissions/Main.scala | 3 + .../scalajs/react/test/emissions/PI.scala | 15 + .../react/test/emissions/RenderReusable.scala | 90 +++ .../test/emissions/RenderWithReuse.scala | 82 +++ .../test/emissions/RenderWithReuseBy.scala | 82 +++ .../resources/rr-sjr/RenderReusable-out2.js | 455 ++++++++++++ .../resources/rr-sjr/RenderReusable-out3.js | 487 ++++++++++++ .../resources/rr-sjr/RenderWithReuse-out2.js | 482 ++++++++++++ .../resources/rr-sjr/RenderWithReuse-out3.js | 514 +++++++++++++ .../rr-sjr/RenderWithReuseBy-out2.js | 501 +++++++++++++ .../rr-sjr/RenderWithReuseBy-out3.js | 536 ++++++++++++++ .../test/emissions/ReactRefreshTest.scala | 12 +- .../react/test/emissions/util/Babel.scala | 4 +- .../react/test/emissions/util/TestJs.scala | 25 +- .../scalajs/react/core/HooksRRTest.scala | 208 ++++++ 21 files changed, 4649 insertions(+), 281 deletions(-) delete mode 100644 library/TODO.md create mode 100644 library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/PI.scala create mode 100644 library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/RenderReusable.scala create mode 100644 library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/RenderWithReuse.scala create mode 100644 library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/RenderWithReuseBy.scala create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/RenderReusable-out2.js create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/RenderReusable-out3.js create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/RenderWithReuse-out2.js create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/RenderWithReuse-out3.js create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/RenderWithReuseBy-out2.js create mode 100644 library/testEmissions/jvm/src/test/resources/rr-sjr/RenderWithReuseBy-out3.js diff --git a/library/TODO.md b/library/TODO.md deleted file mode 100644 index 7f7194e5a..000000000 --- a/library/TODO.md +++ /dev/null @@ -1,13 +0,0 @@ -```scala -// Api.scala - -def renderReusable [A](f: Ctx => Reusable[A])(implicit s: CtorType.Summoner[Box[P], C], v: A => VdomNode): Component[P, s.CT] -def renderReusable [A](f: CtxFn[Reusable[A]])(implicit step: Step, s: CtorType.Summoner[Box[P], C], v: A => VdomNode): Component[P, s.CT] - -def renderWithReuse (f: Ctx => VdomNode)(implicit s: CtorType.Summoner[Box[P], C], r: Reusability[Ctx]): Component[P, s.CT] -def renderWithReuse (f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C], r: Reusability[Ctx]): Component[P, s.CT] -def renderWithReuseBy [A](reusableInputs: Ctx => A)(f: A => VdomNode)(implicit s: CtorType.Summoner[Box[P], C], r: Reusability[A]): Component[P, s.CT] -def renderWithReuseBy [A](reusableInputs: CtxFn[A])(f: A => VdomNode)(implicit step: Step, s: CtorType.Summoner[Box[P], C], r: Reusability[A]): Component[P, s.CT] - -// Custom hooks need rewriting too - see the JS only example. This is going to be time-consuming... Will have to make it low-priority for now... -``` diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala index 4308d5cf0..c84bdf4b8 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacros.scala @@ -4,9 +4,10 @@ import japgolly.microlibs.compiletime.MacroUtils import japgolly.scalajs.react.component.{Js => JsComponent, Scala => ScalaComponent} import japgolly.scalajs.react.hooks.Api._ import japgolly.scalajs.react.hooks.CustomHook.ReusableDepState +import japgolly.scalajs.react.hooks.HookCtx.PC0 import japgolly.scalajs.react.internal.{Box, MacroLogger} -import japgolly.scalajs.react.vdom.TopNode -import japgolly.scalajs.react.{Children, CtorType} +import japgolly.scalajs.react.vdom.{TopNode, VdomNode} +import japgolly.scalajs.react.{Children, CtorType, Reusable} import scala.reflect.macros.blackbox.Context import scala.scalajs.js @@ -15,59 +16,202 @@ object HookMacros { } class HookMacros(val c: Context) extends MacroUtils { - import c.universe._ + import c.universe.{WeakTypeTag => WT, _} + + private def typeTreeOf[A](implicit a: WT[A]): TypeTree = + TypeTree(a.tpe) + + // =================================================================================================================== + // render + + def render1[P: WT, C <: Children: WT, Ctx: WT](f: c.Tree)(s: c.Tree): c.Tree = + _render1[P, C, Ctx](f, s, false) + + def renderDebug1[P: WT, C <: Children: WT, Ctx: WT](f: c.Tree)(s: c.Tree): c.Tree = + _render1[P, C, Ctx](f, s, true) + + private def _render1[P: WT, C <: Children: WT, Ctx: WT](f: c.Tree, s: c.Tree, debug: Boolean): c.Tree = + apply[P, C](s, typeTreeOf[Ctx], debug) { + q"$self.render($f)($s)" + } + + // ------------------------------------------------------------------------------------------------------------------- + + def renderC1[P: WT](f: c.Tree)(s: c.Tree): c.Tree = + _renderC1[P](f, s, false) + + def renderDebugC1[P: WT](f: c.Tree)(s: c.Tree): c.Tree = + _renderC1[P](f, s, true) + + private def _renderC1[P: WT](f: c.Tree, s: c.Tree, debug: Boolean): c.Tree = + apply[P, Children.Varargs](s, typeTreeOf[PC0[P]], debug) { + q"$self.render($f)($s)" + } + + // ------------------------------------------------------------------------------------------------------------------- + + def render2[P: WT, C <: Children: WT, Ctx: WT, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]](f: c.Tree)(step: c.Tree, s: c.Tree): c.Tree = + _render2[P, C, Ctx](f, step, s, false) + + def renderDebug2[P: WT, C <: Children: WT, Ctx: WT, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]](f: c.Tree)(step: c.Tree, s: c.Tree): c.Tree = + _render2[P, C, Ctx](f, step, s, true) + + private def _render2[P: WT, C <: Children: WT, Ctx: WT](f: c.Tree, step: c.Tree, s: c.Tree, debug: Boolean): c.Tree = + apply[P, C](s, typeTreeOf[Ctx], debug) { + q""" + val f = $step.squash($f) + $self.render(f)($s) + """ + } + + // =================================================================================================================== + // renderReusable + + def renderWithReuse1[P: WT, C <: Children: WT, Ctx: WT](f: c.Tree)(s: c.Tree, r: c.Tree): c.Tree = + _renderWithReuse1[P, C, Ctx](f, s, r, false) + + def renderWithReuseDebug1[P: WT, C <: Children: WT, Ctx: WT](f: c.Tree)(s: c.Tree, r: c.Tree): c.Tree = + _renderWithReuse1[P, C, Ctx](f, s, r, true) + + private def _renderWithReuse1[P: WT, C <: Children: WT, Ctx: WT](f: c.Tree, s: c.Tree, r: c.Tree, debug: Boolean): c.Tree = + apply[P, C](s, typeTreeOf[Ctx], debug) { + q"$self.renderWithReuse($f)($s, $r)" + } + + // ------------------------------------------------------------------------------------------------------------------- + + def renderWithReuse1C[P: WT](f: c.Tree)(s: c.Tree, r: c.Tree): c.Tree = + _renderWithReuse1C[P, Children.Varargs](f, s, r, false) + + def renderWithReuseDebug1C[P: WT](f: c.Tree)(s: c.Tree, r: c.Tree): c.Tree = + _renderWithReuse1C[P, Children.Varargs](f, s, r, true) + + private def _renderWithReuse1C[P: WT, C <: Children: WT](f: c.Tree, s: c.Tree, r: c.Tree, debug: Boolean): c.Tree = + apply[P, C](s, typeTreeOf[PC0[P]], debug) { + q"$self.renderWithReuse($f)($s, $r)" + } + + // ------------------------------------------------------------------------------------------------------------------- + + def renderWithReuse2[P: WT, C <: Children: WT, Ctx: WT](f: c.Tree)(step: c.Tree, s: c.Tree, r: c.Tree): c.Tree = + _renderWithReuse2[P, C, Ctx](f, step, s, r, false) + + def renderWithReuseDebug2[P: WT, C <: Children: WT, Ctx: WT](f: c.Tree)(step: c.Tree, s: c.Tree, r: c.Tree): c.Tree = + _renderWithReuse2[P, C, Ctx](f, step, s, r, true) + + private def _renderWithReuse2[P: WT, C <: Children: WT, Ctx: WT](f: c.Tree, step: c.Tree, s: c.Tree, r: c.Tree, debug: Boolean): c.Tree = + apply[P, C](s, typeTreeOf[Ctx], debug) { + q""" + val f = $step.squash($f) + $self.renderWithReuse(f)($s, $r) + """ + } + + // =================================================================================================================== + // renderWithReuse + + def renderReusable1[P: WT, C <: Children: WT, A: WT, Ctx: WT](f: c.Tree)(s: c.Tree, v: c.Tree): c.Tree = + _renderReusable1[P, C, A, Ctx](f, s, v, false) + + def renderReusableDebug1[P: WT, C <: Children: WT, A: WT, Ctx: WT](f: c.Tree)(s: c.Tree, v: c.Tree): c.Tree = + _renderReusable1[P, C, A, Ctx](f, s, v, true) + + private def _renderReusable1[P: WT, C <: Children: WT, A: WT, Ctx: WT](f: c.Tree, s: c.Tree, v: c.Tree, debug: Boolean): c.Tree = + apply[P, C](s, typeTreeOf[Ctx], debug) { + q"$self.renderReusable($f)($s, $v)" + } // ------------------------------------------------------------------------------------------------------------------- - def render1[P, C <: Children](f: c.Tree)(s: c.Tree)(implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = - _render1(f, s, false)(P, C) + def renderReusable1C[P: WT, A: WT](f: c.Tree)(s: c.Tree, v: c.Tree): c.Tree = + _renderReusable1C[P, Children.Varargs, A](f, s, v, false) + + def renderReusableDebug1C[P: WT, A: WT](f: c.Tree)(s: c.Tree, v: c.Tree): c.Tree = + _renderReusable1C[P, Children.Varargs, A](f, s, v, true) + + private def _renderReusable1C[P: WT, C <: Children: WT, A: WT](f: c.Tree, s: c.Tree, v: c.Tree, debug: Boolean): c.Tree = + apply[P, C](s, typeTreeOf[PC0[P]], debug) { + q"$self.renderReusable($f)($s, $v)" + } + + // ------------------------------------------------------------------------------------------------------------------- + + def renderReusable2[P: WT, C <: Children: WT, A: WT, Ctx: WT](f: c.Tree)(step: c.Tree, s: c.Tree, v: c.Tree): c.Tree = + _renderReusable2[P, C, A, Ctx](f, step, s, v, false) + + def renderReusableDebug2[P: WT, C <: Children: WT, A: WT, Ctx: WT](f: c.Tree)(step: c.Tree, s: c.Tree, v: c.Tree): c.Tree = + _renderReusable2[P, C, A, Ctx](f, step, s, v, true) + + private def _renderReusable2[P: WT, C <: Children: WT, A: WT, Ctx: WT](f: c.Tree, step: c.Tree, s: c.Tree, v: c.Tree, debug: Boolean): c.Tree = + apply[P, C](s, typeTreeOf[Ctx], debug) { + q""" + val f = $step.squash($f) + $self.renderReusable(f)($s, $v) + """ + } + + // =================================================================================================================== + // renderWithReuseBy - def renderDebug1[P, C <: Children](f: c.Tree)(s: c.Tree)(implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = - _render1(f, s, true)(P, C) + def renderWithReuseBy1[P: WT, C <: Children: WT, A: WT, Ctx: WT](reusableInputs: c.Tree)(f: c.Tree)(s: c.Tree, r: c.Tree): c.Tree = + _renderWithReuseBy1[P, C, A, Ctx](reusableInputs, f, s, r, false) - private def _render1[P, C <: Children](f: c.Tree, s: c.Tree, debug: Boolean)(implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = - _render[P, C](f, None, s, debug) + def renderWithReuseByDebug1[P: WT, C <: Children: WT, A: WT, Ctx: WT](reusableInputs: c.Tree)(f: c.Tree)(s: c.Tree, r: c.Tree): c.Tree = + _renderWithReuseBy1[P, C, A, Ctx](reusableInputs, f, s, r, true) + + private def _renderWithReuseBy1[P: WT, C <: Children: WT, A: WT, Ctx: WT](i: c.Tree, f: c.Tree, s: c.Tree, r: c.Tree, debug: Boolean): c.Tree = + apply[P, C](s, typeTreeOf[Ctx], debug) { + q"$self.renderWithReuseBy($i)($f)($s, $r)" + } // ------------------------------------------------------------------------------------------------------------------- - def renderC1[P](f: c.Tree)(s: c.Tree)(implicit P: c.WeakTypeTag[P]): c.Tree = - _renderC1(f, s, false)(P) + def renderWithReuseBy1C[P: WT, A: WT](reusableInputs: c.Tree)(f: c.Tree)(s: c.Tree, r: c.Tree): c.Tree = + _renderWithReuseBy1C[P, Children.Varargs, A](reusableInputs, f, s, r, false) - def renderDebugC1[P](f: c.Tree)(s: c.Tree)(implicit P: c.WeakTypeTag[P]): c.Tree = - _renderC1(f, s, true)(P) + def renderWithReuseByDebug1C[P: WT, A: WT](reusableInputs: c.Tree)(f: c.Tree)(s: c.Tree, r: c.Tree): c.Tree = + _renderWithReuseBy1C[P, Children.Varargs, A](reusableInputs, f, s, r, true) - private def _renderC1[P](renderFn: c.Tree, summoner: c.Tree, debug: Boolean)(implicit P: c.WeakTypeTag[P]): c.Tree = - _render[P, Children.Varargs](renderFn, None, summoner, debug) + private def _renderWithReuseBy1C[P: WT, C <: Children: WT, A: WT](i: c.Tree, f: c.Tree, s: c.Tree, r: c.Tree, debug: Boolean): c.Tree = + apply[P, C](s, typeTreeOf[PC0[P]], debug) { + q"$self.renderWithReuseBy($i)($f)($s, $r)" + } // ------------------------------------------------------------------------------------------------------------------- - def render2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]](f: c.Tree)(step: c.Tree, s: c.Tree)(implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = - _render2(f, step, s, false)(P, C) + def renderWithReuseBy2[P: WT, C <: Children: WT, A: WT, Ctx: WT](reusableInputs: c.Tree)(f: c.Tree)(step: c.Tree, s: c.Tree, r: c.Tree): c.Tree = + _renderWithReuseBy2[P, C, A, Ctx](reusableInputs, f, step, s, r, false) - def renderDebug2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]](f: c.Tree)(step: c.Tree, s: c.Tree)(implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = - _render2(f, step, s, true)(P, C) + def renderWithReuseByDebug2[P: WT, C <: Children: WT, A: WT, Ctx: WT](reusableInputs: c.Tree)(f: c.Tree)(step: c.Tree, s: c.Tree, r: c.Tree): c.Tree = + _renderWithReuseBy2[P, C, A, Ctx](reusableInputs, f, step, s, r, true) - private def _render2[P, C <: Children](f: c.Tree, step: c.Tree, s: c.Tree, debug: Boolean)(implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = - _render[P, C](f, Some(step), s, debug) + private def _renderWithReuseBy2[P: WT, C <: Children: WT, A: WT, Ctx: WT](i: c.Tree, f: c.Tree, step: c.Tree, s: c.Tree, r: c.Tree, debug: Boolean): c.Tree = + apply[P, C](s, typeTreeOf[Ctx], debug) { + q""" + val f = $step.squash($f) + $self.renderWithReuseBy($i)(f)($s, $r) + """ + } // =================================================================================================================== private implicit def autoTagToType[A](t: c.WeakTypeTag[A]): Type = t.tpe - private def AHM : Tree = q"_root_.japgolly.scalajs.react.hooks.AbstractHookMacros" - private def Box : Tree = q"_root_.japgolly.scalajs.react.internal.Box" - private def Box(t: Type) : Type = appliedType(c.typeOf[Box[_]], t) - private def CustomHook : Tree = q"_root_.japgolly.scalajs.react.hooks.CustomHook" - private def HookCtx : Tree = q"_root_.japgolly.scalajs.react.hooks.HookCtx" - private def Hooks : Tree = q"_root_.japgolly.scalajs.react.hooks.Hooks" - private def JsComp : Tree = q"_root_.japgolly.scalajs.react.component.Js" - private def JsFn : Tree = q"_root_.japgolly.scalajs.react.component.JsFn" - private def PropsChildren: Tree = q"_root_.japgolly.scalajs.react.PropsChildren" - private def React : Tree = q"_root_.japgolly.scalajs.react.facade.React" - private def Reusable : Tree = q"_root_.japgolly.scalajs.react.Reusable" - private def ScalaFn : Tree = q"_root_.japgolly.scalajs.react.component.ScalaFn" - private def ScalaRef : Tree = q"_root_.japgolly.scalajs.react.Ref" - private def SJS : Tree = q"_root_.scala.scalajs.js" + private def AHM : Tree = q"_root_.japgolly.scalajs.react.hooks.AbstractHookMacros" + private def Box : Tree = q"_root_.japgolly.scalajs.react.internal.Box" + private def Box(t: Type) : Type = appliedType(c.typeOf[Box[_]], t) + private def CustomHook : Tree = q"_root_.japgolly.scalajs.react.hooks.CustomHook" + private def HookCtx : Tree = q"_root_.japgolly.scalajs.react.hooks.HookCtx" + private def Hooks : Tree = q"_root_.japgolly.scalajs.react.hooks.Hooks" + private def JsComp : Tree = q"_root_.japgolly.scalajs.react.component.Js" + private def JsFn : Tree = q"_root_.japgolly.scalajs.react.component.JsFn" + private def PropsChildren : Tree = q"_root_.japgolly.scalajs.react.PropsChildren" + private def React : Tree = q"_root_.japgolly.scalajs.react.facade.React" + private def Reusable : Tree = q"_root_.japgolly.scalajs.react.Reusable" + private def ScalaFn : Tree = q"_root_.japgolly.scalajs.react.component.ScalaFn" + private def ScalaRef : Tree = q"_root_.japgolly.scalajs.react.Ref" + private def ShouldCompUpdate: Tree = q"_root_.japgolly.scalajs.react.internal.ShouldComponentUpdateComponent" + private def SJS : Tree = q"_root_.scala.scalajs.js" private final class HookMacrosImpl extends AbstractHookMacros { import AbstractHookMacros._ @@ -318,13 +462,32 @@ class HookMacros(val c: Context) extends MacroUtils { override protected def vdomRawNode = vdom => q"$vdom.rawNode" + + override protected def reusabilityReusable[A] = tpe => + q"$Reusable.reusableReusability[$tpe]" + + override protected def reusableMap[A, B] = (r, f, _, _) => + q"$r.map($f)" + + override protected def reusableType[A] = tpe => + appliedType(c.typeOf[Reusable[_]], tpe) + + override protected def reusableValue[A] = (r, _) => + q"$r.value" + + override protected def shouldComponentUpdateComponent = (rev, render) => + q"$ShouldCompUpdate($rev, () => $render)" + + override protected def vdomNodeType = + c.typeOf[VdomNode] } // =================================================================================================================== - def _render[P, C <: Children] - (renderFn: c.Tree, stepOption: Option[c.Tree], summoner: c.Tree, debug: Boolean) - (implicit P: c.WeakTypeTag[P], C: c.WeakTypeTag[C]): c.Tree = { + private def self = c.prefix + + private def apply[P, C <: Children](summoner: c.Tree, ctxType: TypeTree, debug: Boolean)(giveUp: Tree) + (implicit P: WT[P], C: WT[C]): c.Tree = { val hookMacros = new HookMacrosImpl @@ -332,19 +495,6 @@ class HookMacros(val c: Context) extends MacroUtils { log.enabled = debug log.header() - def giveUp: Tree = { - val self = c.prefix - stepOption match { - case Some(step) => - q""" - val f = $step.squash($renderFn) - $self.render(f)($summoner) - """ - case None => - q"$self.render($renderFn)($summoner)" - } - } - def onFailure(msg: String): Tree = { import Console._ log(RED_B + WHITE + "Giving up. " + msg + RESET) @@ -368,6 +518,7 @@ class HookMacros(val c: Context) extends MacroUtils { props = q"props.unbox", initChildren = q"val children = $PropsChildren.fromRawProps(props)", children = q"children", + ctxType = ctxType, ) val newBody = rewriter(ctx) c.untypecheck(q""" diff --git a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacrosTraits.scala b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacrosTraits.scala index c86a837c1..55047cf19 100644 --- a/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacrosTraits.scala +++ b/library/coreGeneric/src/main/scala-2/japgolly/scalajs/react/hooks/HookMacrosTraits.scala @@ -10,19 +10,28 @@ trait ApiPrimaryWithRenderMacros[P, C <: Children, Ctx, Step <: AbstractStep] { self: PrimaryWithRender[P, C, Ctx, Step] => final def renderRR(f: Ctx => VdomNode)(implicit s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = - macro HookMacros.render1[P, C] + macro HookMacros.render1[P, C, Ctx] final def renderRRDebug(f: Ctx => VdomNode)(implicit s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = - macro HookMacros.renderDebug1[P, C] + macro HookMacros.renderDebug1[P, C, Ctx] final def renderRRReusable[A](f: Ctx => Reusable[A])(implicit s: CtorType.Summoner[Box[P], C], v: A => VdomNode): Component[P, s.CT] = - renderReusable(f) // TODO: use macro + macro HookMacros.renderReusable1[P, C, A, Ctx] + + final def renderRRReusableDebug[A](f: Ctx => Reusable[A])(implicit s: CtorType.Summoner[Box[P], C], v: A => VdomNode): Component[P, s.CT] = + macro HookMacros.renderReusableDebug1[P, C, A, Ctx] final def renderRRWithReuse(f: Ctx => VdomNode)(implicit s: CtorType.Summoner[Box[P], C], r: Reusability[Ctx]): Component[P, s.CT] = - renderWithReuse(f) // TODO: use macro + macro HookMacros.renderWithReuse1[P, C, Ctx] + + final def renderRRWithReuseDebug(f: Ctx => VdomNode)(implicit s: CtorType.Summoner[Box[P], C], r: Reusability[Ctx]): Component[P, s.CT] = + macro HookMacros.renderWithReuseDebug1[P, C, Ctx] final def renderRRWithReuseBy[A](reusableInputs: Ctx => A)(f: A => VdomNode)(implicit s: CtorType.Summoner[Box[P], C], r: Reusability[A]): Component[P, s.CT] = - renderWithReuseBy(reusableInputs)(f) // TODO: use macro + macro HookMacros.renderWithReuseBy1[P, C, A, Ctx] + + final def renderRRWithReuseByDebug[A](reusableInputs: Ctx => A)(f: A => VdomNode)(implicit s: CtorType.Summoner[Box[P], C], r: Reusability[A]): Component[P, s.CT] = + macro HookMacros.renderWithReuseByDebug1[P, C, A, Ctx] } // ===================================================================================================================== @@ -37,13 +46,22 @@ trait ComponentPCMacros[P] { macro HookMacros.renderDebugC1[P] final def renderRRReusable[A](f: (P, PropsChildren) => Reusable[A])(implicit s: CtorType.Summoner[Box[P], Children.Varargs], v: A => VdomNode): Component[P, s.CT] = - renderReusable(f) // TODO: use macro + macro HookMacros.renderReusable1C[P, A] + + final def renderRRReusableDebug[A](f: (P, PropsChildren) => Reusable[A])(implicit s: CtorType.Summoner[Box[P], Children.Varargs], v: A => VdomNode): Component[P, s.CT] = + macro HookMacros.renderReusableDebug1C[P, A] final def renderRRWithReuse(f: (P, PropsChildren) => VdomNode)(implicit s: CtorType.Summoner[Box[P], Children.Varargs], r: Reusability[Ctx]): Component[P, s.CT] = - renderWithReuse(f) // TODO: use macro + macro HookMacros.renderWithReuse1C[P] + + final def renderRRWithReuseDebug(f: (P, PropsChildren) => VdomNode)(implicit s: CtorType.Summoner[Box[P], Children.Varargs], r: Reusability[Ctx]): Component[P, s.CT] = + macro HookMacros.renderWithReuseDebug1C[P] final def renderRRWithReuseBy[A](reusableInputs: (P, PropsChildren) => A)(f: A => VdomNode)(implicit s: CtorType.Summoner[Box[P], Children.Varargs], r: Reusability[A]): Component[P, s.CT] = - renderWithReuseBy(reusableInputs)(f) // TODO: use macro + macro HookMacros.renderWithReuseBy1C[P, A] + + final def renderRRWithReuseByDebug[A](reusableInputs: (P, PropsChildren) => A)(f: A => VdomNode)(implicit s: CtorType.Summoner[Box[P], Children.Varargs], r: Reusability[A]): Component[P, s.CT] = + macro HookMacros.renderWithReuseByDebug1C[P, A] } // ===================================================================================================================== @@ -58,11 +76,20 @@ trait ApiSecondaryWithRenderMacros[P, C <: Children, Ctx, CtxFn[_], Step <: Subs macro HookMacros.renderDebug2[P, C, Ctx, CtxFn, Step] final def renderRRReusable[A](f: CtxFn[Reusable[A]])(implicit step: Step, s: CtorType.Summoner[Box[P], C], v: A => VdomNode): Component[P, s.CT] = - renderReusable(step.squash(f)(_)) // TODO: use macro + macro HookMacros.renderReusable2[P, C, A, Ctx] + + final def renderRRReusableDebug[A](f: CtxFn[Reusable[A]])(implicit step: Step, s: CtorType.Summoner[Box[P], C], v: A => VdomNode): Component[P, s.CT] = + macro HookMacros.renderReusableDebug2[P, C, A, Ctx] final def renderRRWithReuse(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C], r: Reusability[Ctx]): Component[P, s.CT] = - renderWithReuse(step.squash(f)(_)) // TODO: use macro + macro HookMacros.renderWithReuse2[P, C, Ctx] + + final def renderRRWithReuseDebug(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C], r: Reusability[Ctx]): Component[P, s.CT] = + macro HookMacros.renderWithReuseDebug2[P, C, Ctx] final def renderRRWithReuseBy[A](reusableInputs: CtxFn[A])(f: A => VdomNode)(implicit step: Step, s: CtorType.Summoner[Box[P], C], r: Reusability[A]): Component[P, s.CT] = - renderWithReuseBy(step.squash(reusableInputs)(_))(f) // TODO: use macro + macro HookMacros.renderWithReuseBy2[P, C, A, Ctx] + + final def renderRRWithReuseByDebug[A](reusableInputs: CtxFn[A])(f: A => VdomNode)(implicit step: Step, s: CtorType.Summoner[Box[P], C], r: Reusability[A]): Component[P, s.CT] = + macro HookMacros.renderWithReuseByDebug2[P, C, A, Ctx] } diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala index 8a296ba89..bb91ec4f4 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacros.scala @@ -10,7 +10,7 @@ import japgolly.scalajs.react.hooks.Api.* import japgolly.scalajs.react.hooks.CustomHook import japgolly.scalajs.react.hooks.CustomHook.ReusableDepState import japgolly.scalajs.react.hooks.HookCtx -import japgolly.scalajs.react.internal.{Box, MacroLogger} +import japgolly.scalajs.react.internal.{Box, MacroLogger, ShouldComponentUpdateComponent} import japgolly.scalajs.react.util.DefaultEffects import japgolly.scalajs.react.vdom.{TopNode, VdomNode} import scala.annotation._ @@ -20,8 +20,7 @@ import scala.reflect.ClassTag import scala.scalajs.js object HookMacros { - - // ------------------------------------------------------------------------------------------------------------------- + import AbstractHookMacros.HookStep type PrimaryProxy[P, C <: Children, Ctx, Step <: AbstractStep] = ApiPrimaryWithRenderMacros[P, C, Ctx, Step] @@ -29,86 +28,124 @@ object HookMacros { type PrimaryApi[P, C <: Children, Ctx, Step <: AbstractStep] = PrimaryWithRender[P, C, Ctx, Step] - // https://github.com/lampepfl/dotty/issues/15357 - inline def render1Workaround[P, C <: Children, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]]( + type SecondaryProxy[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] = + ApiSecondaryWithRenderMacros[P, C, Ctx, CtxFn, Step] + + type SecondaryApi[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] = + PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step] + + // Note: *Workaround methods exist due to https://github.com/lampepfl/dotty/issues/15357 + + // =================================================================================================================== + // render + + inline def render1[P, C <: Children, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]]( inline proxy: PrimaryProxy[P, C, Ctx, Step], inline f : Ctx => VdomNode, inline s : CtorType.Summoner.Aux[Box[P], C, CT]): Component[P, CT] = - ${ render1[P, C, Ctx, Step, CT]('proxy, 'f, 's) } + ${ render1Workaround[P, C, Ctx, Step, CT]('proxy, 'f, 's) } - inline def renderDebug1Workaround[P, C <: Children, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]]( + inline def renderDebug1[P, C <: Children, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]]( inline proxy: PrimaryProxy[P, C, Ctx, Step], inline f : Ctx => VdomNode, inline s : CtorType.Summoner.Aux[Box[P], C, CT]): Component[P, CT] = - ${ renderDebug1[P, C, Ctx, Step, CT]('proxy, 'f, 's) } + ${ renderDebug1Workaround[P, C, Ctx, Step, CT]('proxy, 'f, 's) } - def render1[P, C <: Children, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]]( + def render1Workaround[P, C <: Children, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]]( proxy: Expr[PrimaryProxy[P, C, Ctx, Step]], f : Expr[Ctx => VdomNode], s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]]) (using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], Step: Type[Step]): Expr[Component[P, CT]] = _render1(proxy, f, s, false) - def renderDebug1[P, C <: Children, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]]( + def renderDebug1Workaround[P, C <: Children, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]]( proxy: Expr[PrimaryProxy[P, C, Ctx, Step]], f : Expr[Ctx => VdomNode], s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]]) (using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], Step: Type[Step]): Expr[Component[P, CT]] = _render1(proxy, f, s, true) + def _render1[P, C <: Children, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]]( + proxy : Expr[PrimaryProxy[P, C, Ctx, Step]], + renderFn: Expr[Ctx => VdomNode], + summoner: Expr[CtorType.Summoner.Aux[Box[P], C, CT]], + debug : Boolean) + (using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], Step: Type[Step]): Expr[Component[P, CT]] = { + import quotes.reflect.* + val self = proxy.asInstanceOf[Expr[PrimaryApi[P, C, Ctx, Step]]] + apply[P, C, CT]( + macroApplication = self.asTerm, + ctxType = TypeTree.of[Ctx], + summoner = summoner, + debug = debug, + renderStep = HookStep("renderRR", Nil, List(List(renderFn.asTerm), List(summoner.asTerm))), + giveUp = () => '{ $self.render($renderFn)($summoner) }, + ) + } + // ------------------------------------------------------------------------------------------------------------------- - // https://github.com/lampepfl/dotty/issues/15357 - inline def renderC1Workaround[P, CT[-p, +u] <: CtorType[p, u]]( + inline def render1C[P, CT[-p, +u] <: CtorType[p, u]]( inline proxy: ComponentPCMacros[P], inline f : (P, PropsChildren) => VdomNode, inline s : CtorType.Summoner.Aux[Box[P], Children.Varargs, CT]): Component[P, CT] = - ${ renderC1[P, CT]('proxy, 'f, 's) } + ${ render1CWorkaround[P, CT]('proxy, 'f, 's) } - inline def renderDebugC1Workaround[P, CT[-p, +u] <: CtorType[p, u]]( + inline def renderDebug1C[P, CT[-p, +u] <: CtorType[p, u]]( inline proxy: ComponentPCMacros[P], inline f : (P, PropsChildren) => VdomNode, inline s : CtorType.Summoner.Aux[Box[P], Children.Varargs, CT]): Component[P, CT] = - ${ renderDebugC1[P, CT]('proxy, 'f, 's) } + ${ renderDebug1CWorkaround[P, CT]('proxy, 'f, 's) } - def renderC1[P, CT[-p, +u] <: CtorType[p, u]]( + def render1CWorkaround[P, CT[-p, +u] <: CtorType[p, u]]( proxy: Expr[ComponentPCMacros[P]], f : Expr[(P, PropsChildren) => VdomNode], s : Expr[CtorType.Summoner.Aux[Box[P], Children.Varargs, CT]]) (using q: Quotes, P: Type[P], CT: Type[CT]): Expr[Component[P, CT]] = - _renderC1(proxy, f, s, false) + _render1C(proxy, f, s, false) - def renderDebugC1[P, CT[-p, +u] <: CtorType[p, u]]( + def renderDebug1CWorkaround[P, CT[-p, +u] <: CtorType[p, u]]( proxy: Expr[ComponentPCMacros[P]], f : Expr[(P, PropsChildren) => VdomNode], s : Expr[CtorType.Summoner.Aux[Box[P], Children.Varargs, CT]]) (using q: Quotes, P: Type[P], CT: Type[CT]): Expr[Component[P, CT]] = - _renderC1(proxy, f, s, true) + _render1C(proxy, f, s, true) - // ------------------------------------------------------------------------------------------------------------------- - - type SecondaryProxy[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] = - ApiSecondaryWithRenderMacros[P, C, Ctx, CtxFn, Step] + def _render1C[P, CT[-p, +u] <: CtorType[p, u]]( + proxy : Expr[ComponentPCMacros[P]], + renderFn: Expr[(P, PropsChildren) => VdomNode], + summoner: Expr[CtorType.Summoner.Aux[Box[P], Children.Varargs, CT]], + debug : Boolean) + (using q: Quotes, P: Type[P], CT: Type[CT]): Expr[Component[P, CT]] = { + import quotes.reflect.* + val self = proxy.asInstanceOf[Expr[HookComponentBuilder.ComponentPC.First[P]]] + apply[P, Children.Varargs, CT]( + macroApplication = self.asTerm, + ctxType = TypeTree.of[HookCtx.PC0[P]], + summoner = summoner, + debug = debug, + renderStep = HookStep("renderRR", Nil, List(List(renderFn.asTerm), List(summoner.asTerm))), + giveUp = () => '{ $self.render($renderFn)($summoner) }, + ) + } - type SecondaryApi[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]] = - PrimaryWithRender[P, C, Ctx, Step] with Secondary[Ctx, CtxFn, Step] + // ------------------------------------------------------------------------------------------------------------------- - // https://github.com/lampepfl/dotty/issues/15357 - inline def render2Workaround[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]]( + inline def render2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]]( inline proxy: SecondaryProxy[P, C, Ctx, CtxFn, Step], inline f : CtxFn[VdomNode], inline step : Step, inline s : CtorType.Summoner.Aux[Box[P], C, CT]): Component[P, CT] = - ${ render2[P, C, Ctx, CtxFn, Step, CT]('proxy, 'f, 'step, 's) } + ${ render2Workaround[P, C, Ctx, CtxFn, Step, CT]('proxy, 'f, 'step, 's) } - inline def renderDebug2Workaround[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]]( + inline def renderDebug2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]]( inline proxy: SecondaryProxy[P, C, Ctx, CtxFn, Step], inline f : CtxFn[VdomNode], inline step : Step, inline s : CtorType.Summoner.Aux[Box[P], C, CT]): Component[P, CT] = - ${ renderDebug2[P, C, Ctx, CtxFn, Step, CT]('proxy, 'f, 'step, 's) } + ${ renderDebug2Workaround[P, C, Ctx, CtxFn, Step, CT]('proxy, 'f, 'step, 's) } - def render2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]]( + def render2Workaround[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]]( proxy: Expr[SecondaryProxy[P, C, Ctx, CtxFn, Step]], f : Expr[CtxFn[VdomNode]], step : Expr[Step], @@ -116,7 +153,7 @@ object HookMacros { (using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], CtxFn: Type[CtxFn], Step: Type[Step]): Expr[Component[P, CT]] = _render2(proxy, f, step, s, false) - def renderDebug2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]]( + def renderDebug2Workaround[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]]( proxy: Expr[SecondaryProxy[P, C, Ctx, CtxFn, Step]], f : Expr[CtxFn[VdomNode]], step : Expr[Step], @@ -124,6 +161,517 @@ object HookMacros { (using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], CtxFn: Type[CtxFn], Step: Type[Step]): Expr[Component[P, CT]] = _render2(proxy, f, step, s, true) + def _render2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]]( + proxy : Expr[SecondaryProxy[P, C, Ctx, CtxFn, Step]], + renderFn: Expr[CtxFn[VdomNode]], + step : Expr[Step], + summoner: Expr[CtorType.Summoner.Aux[Box[P], C, CT]], + debug : Boolean) + (using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], CtxFn: Type[CtxFn], Step: Type[Step]): Expr[Component[P, CT]] = { + import quotes.reflect.* + val self = proxy.asInstanceOf[Expr[SecondaryApi[P, C, Ctx, CtxFn, Step]]] + apply[P, C, CT]( + macroApplication = self.asTerm, + ctxType = TypeTree.of[Ctx], + summoner = summoner, + debug = debug, + renderStep = HookStep("renderRR", Nil, List(List(renderFn.asTerm), List(step.asTerm, summoner.asTerm))), + giveUp = () => '{ $self.render($step.squash($renderFn)(_))($summoner) }, + ) + } + + // =================================================================================================================== + // renderReusable + + inline def renderReusable1[P, C <: Children, A, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]]( + inline proxy: PrimaryProxy[P, C, Ctx, Step], + inline f : Ctx => Reusable[A], + inline s : CtorType.Summoner.Aux[Box[P], C, CT], + inline v : A => VdomNode): Component[P, CT] = + ${ renderReusable1Workaround[P, C, A, Ctx, Step, CT]('proxy, 'f, 's, 'v) } + + inline def renderReusableDebug1[P, C <: Children, A, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]]( + inline proxy: PrimaryProxy[P, C, Ctx, Step], + inline f : Ctx => Reusable[A], + inline s : CtorType.Summoner.Aux[Box[P], C, CT], + inline v : A => VdomNode): Component[P, CT] = + ${ renderReusableDebug1Workaround[P, C, A, Ctx, Step, CT]('proxy, 'f, 's, 'v) } + + def renderReusable1Workaround[P, C <: Children, A, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]]( + proxy: Expr[PrimaryProxy[P, C, Ctx, Step]], + f : Expr[Ctx => Reusable[A]], + s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], + v : Expr[A => VdomNode]) + (using q: Quotes, P: Type[P], C: Type[C], A: Type[A], CT: Type[CT], Ctx: Type[Ctx], Step: Type[Step]): Expr[Component[P, CT]] = + _renderReusable1(proxy, f, s, v, false) + + def renderReusableDebug1Workaround[P, C <: Children, A, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]]( + proxy: Expr[PrimaryProxy[P, C, Ctx, Step]], + f : Expr[Ctx => Reusable[A]], + s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], + v : Expr[A => VdomNode]) + (using q: Quotes, P: Type[P], C: Type[C], A: Type[A], CT: Type[CT], Ctx: Type[Ctx], Step: Type[Step]): Expr[Component[P, CT]] = + _renderReusable1(proxy, f, s, v, true) + + def _renderReusable1[P, C <: Children, A, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]]( + proxy : Expr[PrimaryProxy[P, C, Ctx, Step]], + f : Expr[Ctx => Reusable[A]], + summoner: Expr[CtorType.Summoner.Aux[Box[P], C, CT]], + v : Expr[A => VdomNode], + debug : Boolean) + (using q: Quotes, P: Type[P], C: Type[C], A: Type[A], CT: Type[CT], Ctx: Type[Ctx], Step: Type[Step]): Expr[Component[P, CT]] = { + import quotes.reflect.* + val self = proxy.asInstanceOf[Expr[PrimaryApi[P, C, Ctx, Step]]] + apply[P, C, CT]( + macroApplication = self.asTerm, + ctxType = TypeTree.of[Ctx], + summoner = summoner, + debug = debug, + renderStep = HookStep("renderRRReusable", List(TypeTree.of[A]), List(List(f.asTerm), List(summoner.asTerm, v.asTerm))), + giveUp = () => '{ $self.renderReusable($f)($summoner, $v) }, + ) + } + + // ------------------------------------------------------------------------------------------------------------------- + + inline def renderReusable1C[P, A, CT[-p, +u] <: CtorType[p, u]]( + inline proxy: ComponentPCMacros[P], + inline f : (P, PropsChildren) => Reusable[A], + inline s : CtorType.Summoner.Aux[Box[P], Children.Varargs, CT], + inline v : A => VdomNode): Component[P, CT] = + ${ renderReusable1CWorkaround[P, A, CT]('proxy, 'f, 's, 'v) } + + inline def renderReusableDebug1C[P, A, CT[-p, +u] <: CtorType[p, u]]( + inline proxy: ComponentPCMacros[P], + inline f : (P, PropsChildren) => Reusable[A], + inline s : CtorType.Summoner.Aux[Box[P], Children.Varargs, CT], + inline v : A => VdomNode): Component[P, CT] = + ${ renderReusableDebug1CWorkaround[P, A, CT]('proxy, 'f, 's, 'v) } + + def renderReusable1CWorkaround[P, A, CT[-p, +u] <: CtorType[p, u]]( + proxy: Expr[ComponentPCMacros[P]], + f : Expr[(P, PropsChildren) => Reusable[A]], + s : Expr[CtorType.Summoner.Aux[Box[P], Children.Varargs, CT]], + v : Expr[A => VdomNode]) + (using q: Quotes, P: Type[P], A: Type[A], CT: Type[CT]): Expr[Component[P, CT]] = + _renderReusable1C(proxy, f, s, v, false) + + def renderReusableDebug1CWorkaround[P, A, CT[-p, +u] <: CtorType[p, u]]( + proxy: Expr[ComponentPCMacros[P]], + f : Expr[(P, PropsChildren) => Reusable[A]], + s : Expr[CtorType.Summoner.Aux[Box[P], Children.Varargs, CT]], + v : Expr[A => VdomNode]) + (using q: Quotes, P: Type[P], A: Type[A], CT: Type[CT]): Expr[Component[P, CT]] = + _renderReusable1C(proxy, f, s, v, true) + + def _renderReusable1C[P, A, CT[-p, +u] <: CtorType[p, u]]( + proxy : Expr[ComponentPCMacros[P]], + f : Expr[(P, PropsChildren) => Reusable[A]], + summoner: Expr[CtorType.Summoner.Aux[Box[P], Children.Varargs, CT]], + v : Expr[A => VdomNode], + debug : Boolean) + (using q: Quotes, P: Type[P], A: Type[A], CT: Type[CT]): Expr[Component[P, CT]] = { + import quotes.reflect.* + val self = proxy.asInstanceOf[Expr[HookComponentBuilder.ComponentPC.First[P]]] + apply[P, Children.Varargs, CT]( + macroApplication = self.asTerm, + ctxType = TypeTree.of[HookCtx.PC0[P]], + summoner = summoner, + debug = debug, + renderStep = HookStep("renderRRReusable", List(TypeTree.of[A]), List(List(f.asTerm), List(summoner.asTerm, v.asTerm))), + giveUp = () => '{ $self.renderReusable($f)($summoner, $v) }, + ) + } + + // ------------------------------------------------------------------------------------------------------------------- + + inline def renderReusable2[P, C <: Children, A, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]]( + inline proxy: SecondaryProxy[P, C, Ctx, CtxFn, Step], + inline f : CtxFn[Reusable[A]], + inline step : Step, + inline s : CtorType.Summoner.Aux[Box[P], C, CT], + inline v : A => VdomNode): Component[P, CT] = + ${ renderReusable2Workaround[P, C, A, Ctx, CtxFn, Step, CT]('proxy, 'f, 'step, 's, 'v) } + + inline def renderReusableDebug2[P, C <: Children, A, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]]( + inline proxy: SecondaryProxy[P, C, Ctx, CtxFn, Step], + inline f : CtxFn[Reusable[A]], + inline step : Step, + inline s : CtorType.Summoner.Aux[Box[P], C, CT], + inline v : A => VdomNode): Component[P, CT] = + ${ renderReusableDebug2Workaround[P, C, A, Ctx, CtxFn, Step, CT]('proxy, 'f, 'step, 's, 'v) } + + def renderReusable2Workaround[P, C <: Children, A, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]]( + proxy: Expr[SecondaryProxy[P, C, Ctx, CtxFn, Step]], + f : Expr[CtxFn[Reusable[A]]], + step : Expr[Step], + s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], + v : Expr[A => VdomNode]) + (using q: Quotes, P: Type[P], C: Type[C], A: Type[A], CT: Type[CT], Ctx: Type[Ctx], CtxFn: Type[CtxFn], Step: Type[Step]): Expr[Component[P, CT]] = + _renderReusable2(proxy, f, step, s, v, false) + + def renderReusableDebug2Workaround[P, C <: Children, A, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]]( + proxy: Expr[SecondaryProxy[P, C, Ctx, CtxFn, Step]], + f : Expr[CtxFn[Reusable[A]]], + step : Expr[Step], + s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], + v : Expr[A => VdomNode]) + (using q: Quotes, P: Type[P], C: Type[C], A: Type[A], CT: Type[CT], Ctx: Type[Ctx], CtxFn: Type[CtxFn], Step: Type[Step]): Expr[Component[P, CT]] = + _renderReusable2(proxy, f, step, s, v, true) + + def _renderReusable2[P, C <: Children, A, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]]( + proxy : Expr[SecondaryProxy[P, C, Ctx, CtxFn, Step]], + f : Expr[CtxFn[Reusable[A]]], + step : Expr[Step], + summoner: Expr[CtorType.Summoner.Aux[Box[P], C, CT]], + v : Expr[A => VdomNode], + debug : Boolean) + (using q: Quotes, P: Type[P], C: Type[C], A: Type[A], CT: Type[CT], Ctx: Type[Ctx], CtxFn: Type[CtxFn], Step: Type[Step]): Expr[Component[P, CT]] = { + import quotes.reflect.* + val self = proxy.asInstanceOf[Expr[SecondaryApi[P, C, Ctx, CtxFn, Step]]] + apply[P, C, CT]( + macroApplication = self.asTerm, + ctxType = TypeTree.of[Ctx], + summoner = summoner, + debug = debug, + renderStep = HookStep("renderRRReusable", List(TypeTree.of[A]), List(List(f.asTerm), List(step.asTerm, summoner.asTerm, v.asTerm))), + giveUp = () => '{ $self.renderReusable($step.squash($f)(_))($summoner, $v) }, + ) + } + + // =================================================================================================================== + // renderWithReuse + + inline def renderWithReuse1[P, C <: Children, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]]( + inline proxy: PrimaryProxy[P, C, Ctx, Step], + inline f : Ctx => VdomNode, + inline s : CtorType.Summoner.Aux[Box[P], C, CT], + inline r : Reusability[Ctx]): Component[P, CT] = + ${ renderWithReuse1Workaround[P, C, Ctx, Step, CT]('proxy, 'f, 's, 'r) } + + inline def renderWithReuseDebug1[P, C <: Children, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]]( + inline proxy: PrimaryProxy[P, C, Ctx, Step], + inline f : Ctx => VdomNode, + inline s : CtorType.Summoner.Aux[Box[P], C, CT], + inline r : Reusability[Ctx]): Component[P, CT] = + ${ renderWithReuseDebug1Workaround[P, C, Ctx, Step, CT]('proxy, 'f, 's, 'r) } + + def renderWithReuse1Workaround[P, C <: Children, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]]( + proxy: Expr[PrimaryProxy[P, C, Ctx, Step]], + f : Expr[Ctx => VdomNode], + s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], + r : Expr[Reusability[Ctx]]) + (using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], Step: Type[Step]): Expr[Component[P, CT]] = + _renderWithReuse1(proxy, f, s, r, false) + + def renderWithReuseDebug1Workaround[P, C <: Children, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]]( + proxy: Expr[PrimaryProxy[P, C, Ctx, Step]], + f : Expr[Ctx => VdomNode], + s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], + r : Expr[Reusability[Ctx]]) + (using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], Step: Type[Step]): Expr[Component[P, CT]] = + _renderWithReuse1(proxy, f, s, r, true) + + def _renderWithReuse1[P, C <: Children, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]]( + proxy : Expr[PrimaryProxy[P, C, Ctx, Step]], + renderFn: Expr[Ctx => VdomNode], + summoner: Expr[CtorType.Summoner.Aux[Box[P], C, CT]], + r : Expr[Reusability[Ctx]], + debug : Boolean) + (using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], Step: Type[Step]): Expr[Component[P, CT]] = { + import quotes.reflect.* + val self = proxy.asInstanceOf[Expr[PrimaryApi[P, C, Ctx, Step]]] + apply[P, C, CT]( + macroApplication = self.asTerm, + ctxType = TypeTree.of[Ctx], + summoner = summoner, + debug = debug, + renderStep = HookStep("renderRRWithReuse", Nil, List(List(renderFn.asTerm), List(summoner.asTerm, r.asTerm))), + giveUp = () => '{ $self.renderWithReuse($renderFn)($summoner, $r) }, + ) + } + + // ------------------------------------------------------------------------------------------------------------------- + + inline def renderWithReuse1C[P, CT[-p, +u] <: CtorType[p, u]]( + inline proxy: ComponentPCMacros[P], + inline f : (P, PropsChildren) => VdomNode, + inline s : CtorType.Summoner.Aux[Box[P], Children.Varargs, CT], + inline r : Reusability[HookCtx.PC0[P]]): Component[P, CT] = + ${ renderWithReuse1CWorkaround[P, CT]('proxy, 'f, 's, 'r) } + + inline def renderWithReuseDebug1C[P, CT[-p, +u] <: CtorType[p, u]]( + inline proxy: ComponentPCMacros[P], + inline f : (P, PropsChildren) => VdomNode, + inline s : CtorType.Summoner.Aux[Box[P], Children.Varargs, CT], + inline r : Reusability[HookCtx.PC0[P]]): Component[P, CT] = + ${ renderWithReuseDebug1CWorkaround[P, CT]('proxy, 'f, 's, 'r) } + + def renderWithReuse1CWorkaround[P, CT[-p, +u] <: CtorType[p, u]]( + proxy: Expr[ComponentPCMacros[P]], + f : Expr[(P, PropsChildren) => VdomNode], + s : Expr[CtorType.Summoner.Aux[Box[P], Children.Varargs, CT]], + r : Expr[Reusability[HookCtx.PC0[P]]]) + (using q: Quotes, P: Type[P], CT: Type[CT]): Expr[Component[P, CT]] = + _renderWithReuse1C(proxy, f, s, r, false) + + def renderWithReuseDebug1CWorkaround[P, CT[-p, +u] <: CtorType[p, u]]( + proxy: Expr[ComponentPCMacros[P]], + f : Expr[(P, PropsChildren) => VdomNode], + s : Expr[CtorType.Summoner.Aux[Box[P], Children.Varargs, CT]], + r : Expr[Reusability[HookCtx.PC0[P]]]) + (using q: Quotes, P: Type[P], CT: Type[CT]): Expr[Component[P, CT]] = + _renderWithReuse1C(proxy, f, s, r, true) + + def _renderWithReuse1C[P, CT[-p, +u] <: CtorType[p, u]]( + proxy : Expr[ComponentPCMacros[P]], + renderFn: Expr[(P, PropsChildren) => VdomNode], + summoner: Expr[CtorType.Summoner.Aux[Box[P], Children.Varargs, CT]], + r : Expr[Reusability[HookCtx.PC0[P]]], + debug : Boolean) + (using q: Quotes, P: Type[P], CT: Type[CT]): Expr[Component[P, CT]] = { + import quotes.reflect.* + val self = proxy.asInstanceOf[Expr[HookComponentBuilder.ComponentPC.First[P]]] + apply[P, Children.Varargs, CT]( + macroApplication = self.asTerm, + ctxType = TypeTree.of[HookCtx.PC0[P]], + summoner = summoner, + debug = debug, + renderStep = HookStep("renderRRWithReuse", Nil, List(List(renderFn.asTerm), List(summoner.asTerm, r.asTerm))), + giveUp = () => '{ $self.renderWithReuse($renderFn)($summoner, $r) }, + ) + } + + // ------------------------------------------------------------------------------------------------------------------- + + inline def renderWithReuse2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]]( + inline proxy: SecondaryProxy[P, C, Ctx, CtxFn, Step], + inline f : CtxFn[VdomNode], + inline step : Step, + inline s : CtorType.Summoner.Aux[Box[P], C, CT], + inline r : Reusability[Ctx]): Component[P, CT] = + ${ renderWithReuse2Workaround[P, C, Ctx, CtxFn, Step, CT]('proxy, 'f, 'step, 's, 'r) } + + inline def renderWithReuseDebug2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]]( + inline proxy: SecondaryProxy[P, C, Ctx, CtxFn, Step], + inline f : CtxFn[VdomNode], + inline step : Step, + inline s : CtorType.Summoner.Aux[Box[P], C, CT], + inline r : Reusability[Ctx]): Component[P, CT] = + ${ renderWithReuseDebug2Workaround[P, C, Ctx, CtxFn, Step, CT]('proxy, 'f, 'step, 's, 'r) } + + def renderWithReuse2Workaround[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]]( + proxy: Expr[SecondaryProxy[P, C, Ctx, CtxFn, Step]], + f : Expr[CtxFn[VdomNode]], + step : Expr[Step], + s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], + r : Expr[Reusability[Ctx]]) + (using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], CtxFn: Type[CtxFn], Step: Type[Step]): Expr[Component[P, CT]] = + _renderWithReuse2(proxy, f, step, s, r, false) + + def renderWithReuseDebug2Workaround[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]]( + proxy: Expr[SecondaryProxy[P, C, Ctx, CtxFn, Step]], + f : Expr[CtxFn[VdomNode]], + step : Expr[Step], + s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], + r : Expr[Reusability[Ctx]]) + (using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], CtxFn: Type[CtxFn], Step: Type[Step]): Expr[Component[P, CT]] = + _renderWithReuse2(proxy, f, step, s, r, true) + + def _renderWithReuse2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]]( + proxy : Expr[SecondaryProxy[P, C, Ctx, CtxFn, Step]], + renderFn: Expr[CtxFn[VdomNode]], + step : Expr[Step], + summoner: Expr[CtorType.Summoner.Aux[Box[P], C, CT]], + r : Expr[Reusability[Ctx]], + debug : Boolean) + (using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], CtxFn: Type[CtxFn], Step: Type[Step]): Expr[Component[P, CT]] = { + import quotes.reflect.* + val self = proxy.asInstanceOf[Expr[SecondaryApi[P, C, Ctx, CtxFn, Step]]] + apply[P, C, CT]( + macroApplication = self.asTerm, + ctxType = TypeTree.of[Ctx], + summoner = summoner, + debug = debug, + renderStep = HookStep("renderRRWithReuse", Nil, List(List(renderFn.asTerm), List(step.asTerm, summoner.asTerm, r.asTerm))), + giveUp = () => '{ $self.renderWithReuse($step.squash($renderFn)(_))($summoner, $r) }, + ) + } + + // =================================================================================================================== + // renderWithReuseBy + + inline def renderWithReuseBy1[P, C <: Children, A, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]]( + inline proxy: PrimaryProxy[P, C, Ctx, Step], + inline i : Ctx => A, + inline f : A => VdomNode, + inline s : CtorType.Summoner.Aux[Box[P], C, CT], + inline r : Reusability[A]): Component[P, CT] = + ${ renderWithReuseBy1Workaround[P, C, A, Ctx, Step, CT]('proxy, 'i, 'f, 's, 'r) } + + inline def renderWithReuseByDebug1[P, C <: Children, A, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]]( + inline proxy: PrimaryProxy[P, C, Ctx, Step], + inline i : Ctx => A, + inline f : A => VdomNode, + inline s : CtorType.Summoner.Aux[Box[P], C, CT], + inline r : Reusability[A]): Component[P, CT] = + ${ renderWithReuseByDebug1Workaround[P, C, A, Ctx, Step, CT]('proxy, 'i, 'f, 's, 'r) } + + def renderWithReuseBy1Workaround[P, C <: Children, A, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]]( + proxy: Expr[PrimaryProxy[P, C, Ctx, Step]], + i : Expr[Ctx => A], + f : Expr[A => VdomNode], + s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], + r : Expr[Reusability[A]]) + (using q: Quotes, P: Type[P], C: Type[C], A: Type[A], CT: Type[CT], Ctx: Type[Ctx], Step: Type[Step]): Expr[Component[P, CT]] = + _renderWithReuseBy1(proxy, i, f, s, r, false) + + def renderWithReuseByDebug1Workaround[P, C <: Children, A, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]]( + proxy: Expr[PrimaryProxy[P, C, Ctx, Step]], + i : Expr[Ctx => A], + f : Expr[A => VdomNode], + s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], + r : Expr[Reusability[A]]) + (using q: Quotes, P: Type[P], C: Type[C], A: Type[A], CT: Type[CT], Ctx: Type[Ctx], Step: Type[Step]): Expr[Component[P, CT]] = + _renderWithReuseBy1(proxy, i, f, s, r, true) + + def _renderWithReuseBy1[P, C <: Children, A, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]]( + proxy : Expr[PrimaryProxy[P, C, Ctx, Step]], + i : Expr[Ctx => A], + f : Expr[A => VdomNode], + summoner: Expr[CtorType.Summoner.Aux[Box[P], C, CT]], + r : Expr[Reusability[A]], + debug : Boolean) + (using q: Quotes, P: Type[P], C: Type[C], A: Type[A], CT: Type[CT], Ctx: Type[Ctx], Step: Type[Step]): Expr[Component[P, CT]] = { + import quotes.reflect.* + val self = proxy.asInstanceOf[Expr[PrimaryApi[P, C, Ctx, Step]]] + apply[P, C, CT]( + macroApplication = self.asTerm, + ctxType = TypeTree.of[Ctx], + summoner = summoner, + debug = debug, + renderStep = HookStep("renderRRWithReuseBy", List(TypeTree.of[A]), List(List(i.asTerm), List(f.asTerm), List(summoner.asTerm, r.asTerm))), + giveUp = () => '{ $self.renderWithReuseBy($i)($f)($summoner, $r) }, + ) + } + + // ------------------------------------------------------------------------------------------------------------------- + + inline def renderWithReuseBy1C[P, A, CT[-p, +u] <: CtorType[p, u]]( + inline proxy: ComponentPCMacros[P], + inline i : (P, PropsChildren) => A, + inline f : A => VdomNode, + inline s : CtorType.Summoner.Aux[Box[P], Children.Varargs, CT], + inline r : Reusability[A]): Component[P, CT] = + ${ renderWithReuseBy1CWorkaround[P, A, CT]('proxy, 'i, 'f, 's, 'r) } + + inline def renderWithReuseByDebug1C[P, A, CT[-p, +u] <: CtorType[p, u]]( + inline proxy: ComponentPCMacros[P], + inline i : (P, PropsChildren) => A, + inline f : A => VdomNode, + inline s : CtorType.Summoner.Aux[Box[P], Children.Varargs, CT], + inline r : Reusability[A]): Component[P, CT] = + ${ renderWithReuseByDebug1CWorkaround[P, A, CT]('proxy, 'i, 'f, 's, 'r) } + + def renderWithReuseBy1CWorkaround[P, A, CT[-p, +u] <: CtorType[p, u]]( + proxy: Expr[ComponentPCMacros[P]], + i : Expr[(P, PropsChildren) => A], + f : Expr[A => VdomNode], + s : Expr[CtorType.Summoner.Aux[Box[P], Children.Varargs, CT]], + r : Expr[Reusability[A]]) + (using q: Quotes, P: Type[P], A: Type[A], CT: Type[CT]): Expr[Component[P, CT]] = + _renderWithReuseBy1C(proxy, i, f, s, r, false) + + def renderWithReuseByDebug1CWorkaround[P, A, CT[-p, +u] <: CtorType[p, u]]( + proxy: Expr[ComponentPCMacros[P]], + i : Expr[(P, PropsChildren) => A], + f : Expr[A => VdomNode], + s : Expr[CtorType.Summoner.Aux[Box[P], Children.Varargs, CT]], + r : Expr[Reusability[A]]) + (using q: Quotes, P: Type[P], A: Type[A], CT: Type[CT]): Expr[Component[P, CT]] = + _renderWithReuseBy1C(proxy, i, f, s, r, true) + + def _renderWithReuseBy1C[P, A, CT[-p, +u] <: CtorType[p, u]]( + proxy : Expr[ComponentPCMacros[P]], + i : Expr[(P, PropsChildren) => A], + f : Expr[A => VdomNode], + summoner: Expr[CtorType.Summoner.Aux[Box[P], Children.Varargs, CT]], + r : Expr[Reusability[A]], + debug : Boolean) + (using q: Quotes, P: Type[P], A: Type[A], CT: Type[CT]): Expr[Component[P, CT]] = { + import quotes.reflect.* + val self = proxy.asInstanceOf[Expr[HookComponentBuilder.ComponentPC.First[P]]] + apply[P, Children.Varargs, CT]( + macroApplication = self.asTerm, + ctxType = TypeTree.of[HookCtx.PC0[P]], + summoner = summoner, + debug = debug, + renderStep = HookStep("renderRRWithReuseBy", List(TypeTree.of[A]), List(List(i.asTerm), List(f.asTerm), List(summoner.asTerm, r.asTerm))), + giveUp = () => '{ $self.renderWithReuseBy($i)($f)($summoner, $r) }, + ) + } + + // ------------------------------------------------------------------------------------------------------------------- + + inline def renderWithReuseBy2[P, C <: Children, A, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]]( + inline proxy: SecondaryProxy[P, C, Ctx, CtxFn, Step], + inline i : CtxFn[A], + inline f : A => VdomNode, + inline step : Step, + inline s : CtorType.Summoner.Aux[Box[P], C, CT], + inline r : Reusability[A]): Component[P, CT] = + ${ renderWithReuseBy2Workaround[P, C, A, Ctx, CtxFn, Step, CT]('proxy, 'i, 'f, 'step, 's, 'r) } + + inline def renderWithReuseByDebug2[P, C <: Children, A, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]]( + inline proxy: SecondaryProxy[P, C, Ctx, CtxFn, Step], + inline i : CtxFn[A], + inline f : A => VdomNode, + inline step : Step, + inline s : CtorType.Summoner.Aux[Box[P], C, CT], + inline r : Reusability[A]): Component[P, CT] = + ${ renderWithReuseByDebug2Workaround[P, C, A, Ctx, CtxFn, Step, CT]('proxy, 'i, 'f, 'step, 's, 'r) } + + def renderWithReuseBy2Workaround[P, C <: Children, A, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]]( + proxy: Expr[SecondaryProxy[P, C, Ctx, CtxFn, Step]], + i : Expr[CtxFn[A]], + f : Expr[A => VdomNode], + step : Expr[Step], + s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], + r : Expr[Reusability[A]]) + (using q: Quotes, P: Type[P], C: Type[C], A: Type[A], CT: Type[CT], Ctx: Type[Ctx], CtxFn: Type[CtxFn], Step: Type[Step]): Expr[Component[P, CT]] = + _renderWithReuseBy2(proxy, i, f, step, s, r, false) + + def renderWithReuseByDebug2Workaround[P, C <: Children, A, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]]( + proxy: Expr[SecondaryProxy[P, C, Ctx, CtxFn, Step]], + i : Expr[CtxFn[A]], + f : Expr[A => VdomNode], + step : Expr[Step], + s : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], + r : Expr[Reusability[A]]) + (using q: Quotes, P: Type[P], C: Type[C], A: Type[A], CT: Type[CT], Ctx: Type[Ctx], CtxFn: Type[CtxFn], Step: Type[Step]): Expr[Component[P, CT]] = + _renderWithReuseBy2(proxy, i, f, step, s, r, true) + + def _renderWithReuseBy2[P, C <: Children, A, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]]( + proxy : Expr[SecondaryProxy[P, C, Ctx, CtxFn, Step]], + i : Expr[CtxFn[A]], + f : Expr[A => VdomNode], + step : Expr[Step], + summoner: Expr[CtorType.Summoner.Aux[Box[P], C, CT]], + r : Expr[Reusability[A]], + debug : Boolean) + (using q: Quotes, P: Type[P], C: Type[C], A: Type[A], CT: Type[CT], Ctx: Type[Ctx], CtxFn: Type[CtxFn], Step: Type[Step]): Expr[Component[P, CT]] = { + import quotes.reflect.* + val self = proxy.asInstanceOf[Expr[SecondaryApi[P, C, Ctx, CtxFn, Step]]] + apply[P, C, CT]( + macroApplication = self.asTerm, + ctxType = TypeTree.of[Ctx], + summoner = summoner, + debug = debug, + renderStep = HookStep("renderRRWithReuseBy", List(TypeTree.of[A]), List(List(i.asTerm), List(f.asTerm), List(summoner.asTerm, r.asTerm))), + giveUp = () => '{ $self.renderWithReuseBy($step.squash($i)(_))($f)($summoner, $r) }, + ) + } + // =================================================================================================================== private def HookMacrosImpl(qq: Quotes): HookMacrosImpl { val q: qq.type } = @@ -141,6 +689,12 @@ object HookMacros { // TODO: Move into microlibs extension (self: q.reflect.TypeTree) { + @targetName("typeTree_asTypeOf") + def asTypeOf[A <: AnyKind]: Tpe[A] = + self.asType.asInstanceOf[Tpe[A]] + } + extension (self: q.reflect.TypeRepr) { + @targetName("typeRepr_asTypeOf") def asTypeOf[A <: AnyKind]: Tpe[A] = self.asType.asInstanceOf[Tpe[A]] } @@ -420,78 +974,33 @@ object HookMacros { override protected def vdomRawNode = vdom => '{ $vdom.rawNode } - } - - // =================================================================================================================== - import AbstractHookMacros.HookStep + override protected def reusabilityReusable[A] = implicit tpe => + '{ Reusable.reusableReusability[A] } - def _render1[P, C <: Children, Ctx, Step <: AbstractStep, CT[-p, +u] <: CtorType[p, u]]( - proxy : Expr[PrimaryProxy[P, C, Ctx, Step]], - renderFn: Expr[Ctx => VdomNode], - summoner: Expr[CtorType.Summoner.Aux[Box[P], C, CT]], - debug : Boolean) - (using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], Step: Type[Step]): Expr[Component[P, CT]] = { + override protected def reusableMap[A, B] = implicit (r, f, tpeA, tpeB) => + '{ $r.map($f) } - import quotes.reflect.* - - val self = proxy.asInstanceOf[Expr[PrimaryApi[P, C, Ctx, Step]]] - - _render[P, C, CT]( - macroApplication = self.asTerm, - summoner = summoner, - debug = debug, - renderStep = HookStep("renderRR", Nil, List(List(renderFn.asTerm), List(summoner.asTerm))), - giveUp = () => '{ $self.render($renderFn)($summoner) }, - ) - } - - def _renderC1[P, CT[-p, +u] <: CtorType[p, u]]( - proxy : Expr[ComponentPCMacros[P]], - renderFn: Expr[(P, PropsChildren) => VdomNode], - summoner: Expr[CtorType.Summoner.Aux[Box[P], Children.Varargs, CT]], - debug : Boolean) - (using q: Quotes, P: Type[P], CT: Type[CT]): Expr[Component[P, CT]] = { - - import quotes.reflect.* - - val self = proxy.asInstanceOf[Expr[HookComponentBuilder.ComponentPC.First[P]]] - - _render[P, Children.Varargs, CT]( - macroApplication = self.asTerm, - summoner = summoner, - debug = debug, - renderStep = HookStep("renderRR", Nil, List(List(renderFn.asTerm), List(summoner.asTerm))), - giveUp = () => '{ $self.render($renderFn)($summoner) }, - ) - } - - def _render2[P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn], CT[-p, +u] <: CtorType[p, u]]( - proxy : Expr[SecondaryProxy[P, C, Ctx, CtxFn, Step]], - renderFn: Expr[CtxFn[VdomNode]], - step : Expr[Step], - summoner: Expr[CtorType.Summoner.Aux[Box[P], C, CT]], - debug : Boolean) - (using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT], Ctx: Type[Ctx], CtxFn: Type[CtxFn], Step: Type[Step]): Expr[Component[P, CT]] = { + override protected def reusableType[A] = { + case '[a] => Tpe.of[Reusable[a]].asInstanceOf[Type[Reusable[A]]] + } - import quotes.reflect.* + override protected def reusableValue[A] = implicit (r, tpe) => + '{ $r.value } - val self = proxy.asInstanceOf[Expr[SecondaryApi[P, C, Ctx, CtxFn, Step]]] + override protected def shouldComponentUpdateComponent = (rev, render) => + '{ ShouldComponentUpdateComponent($rev, () => $render) } - _render[P, C, CT]( - macroApplication = self.asTerm, - summoner = summoner, - debug = debug, - renderStep = HookStep("renderRR", Nil, List(List(renderFn.asTerm), List(step.asTerm, summoner.asTerm))), - giveUp = () => '{ $self.render($step.squash($renderFn)(_))($summoner) }, - ) + override protected def vdomNodeType = + Tpe.of[VdomNode] } // =================================================================================================================== - private def _render[P, C <: Children, CT[-p, +u] <: CtorType[p, u]]( + private def apply[P, C <: Children, CT[-p, +u] <: CtorType[p, u]]( using q: Quotes, P: Type[P], C: Type[C], CT: Type[CT])( macroApplication: q.reflect.Term, + ctxType : q.reflect.TypeTree, summoner : Expr[CtorType.Summoner.Aux[Box[P], C, CT]], debug : Boolean, renderStep : HookStep[q.reflect.Term, q.reflect.TypeTree], @@ -533,6 +1042,7 @@ object HookMacros { props = '{ $props.unbox }.asTerm, initChildren = children.valDef, children = children.ref.asTerm, + ctxType = ctxType, ) rewriter(ctx) } diff --git a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala index 629d3b1f4..341d41a22 100644 --- a/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala +++ b/library/coreGeneric/src/main/scala-3/japgolly/scalajs/react/hooks/HookMacrosTraits.scala @@ -23,19 +23,29 @@ object ApiPrimaryWithRenderMacros { extension [P, C <: Children, Ctx, Step <: AbstractStep](inline self: ApiPrimaryWithRenderMacros[P, C, Ctx, Step]) { inline def renderRR(inline f: Ctx => VdomNode)(implicit inline s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = - HookMacros.render1Workaround[P, C, Ctx, Step, s.CT](self, f, s) + HookMacros.render1[P, C, Ctx, Step, s.CT](self, f, s) inline def renderRRDebug(inline f: Ctx => VdomNode)(implicit inline s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = - HookMacros.renderDebug1Workaround[P, C, Ctx, Step, s.CT](self, f, s) + HookMacros.renderDebug1[P, C, Ctx, Step, s.CT](self, f, s) - inline def renderRRReusable[A](f: Ctx => Reusable[A])(implicit s: CtorType.Summoner[Box[P], C], v: A => VdomNode): Component[P, s.CT] = - renderReusable(f) // TODO: use macro + inline def renderRRReusable[A](inline f: Ctx => Reusable[A])(implicit s: CtorType.Summoner[Box[P], C], inline v: A => VdomNode): Component[P, s.CT] = + HookMacros.renderReusable1[P, C, A, Ctx, Step, s.CT](self, f, s, v) - inline def renderRRWithReuse(f: Ctx => VdomNode)(implicit s: CtorType.Summoner[Box[P], C], r: Reusability[Ctx]): Component[P, s.CT] = - renderWithReuse(f) // TODO: use macro + inline def renderRRReusableDebug[A](inline f: Ctx => Reusable[A])(implicit s: CtorType.Summoner[Box[P], C], inline v: A => VdomNode): Component[P, s.CT] = + HookMacros.renderReusableDebug1[P, C, A, Ctx, Step, s.CT](self, f, s, v) - inline def renderRRWithReuseBy[A](reusableInputs: Ctx => A)(f: A => VdomNode)(implicit s: CtorType.Summoner[Box[P], C], r: Reusability[A]): Component[P, s.CT] = - renderWithReuseBy(reusableInputs)(f) // TODO: use macro + inline def renderRRWithReuse(inline f: Ctx => VdomNode)(implicit inline s: CtorType.Summoner[Box[P], C], inline r: Reusability[Ctx]): Component[P, s.CT] = + HookMacros.renderWithReuse1[P, C, Ctx, Step, s.CT](self, f, s, r) + + inline def renderRRWithReuseDebug(inline f: Ctx => VdomNode)(implicit inline s: CtorType.Summoner[Box[P], C], inline r: Reusability[Ctx]): Component[P, s.CT] = + HookMacros.renderWithReuseDebug1[P, C, Ctx, Step, s.CT](self, f, s, r) + + inline def renderRRWithReuseBy[A](inline reusableInputs: Ctx => A)(inline f: A => VdomNode) + (implicit inline s: CtorType.Summoner[Box[P], C], inline r: Reusability[A]): Component[P, s.CT] = + HookMacros.renderWithReuseBy1[P, C, A, Ctx, Step, s.CT](self, reusableInputs, f, s, r) + + inline def renderRRWithReuseByDebug[A](inline reusableInputs: Ctx => A)(inline f: A => VdomNode)(implicit inline s: CtorType.Summoner[Box[P], C], inline r: Reusability[A]): Component[P, s.CT] = + HookMacros.renderWithReuseByDebug1[P, C, A, Ctx, Step, s.CT](self, reusableInputs, f, s, r) } } @@ -50,19 +60,28 @@ object ComponentPCMacros { extension [P](inline self: ComponentPCMacros[P]) { inline def renderRR(inline f: (P, PropsChildren) => VdomNode)(implicit inline s: CtorType.Summoner[Box[P], Children.Varargs]): Component[P, s.CT] = - HookMacros.renderC1Workaround[P, s.CT](self, f, s) + HookMacros.render1C[P, s.CT](self, f, s) inline def renderRRDebug(inline f: (P, PropsChildren) => VdomNode)(implicit inline s: CtorType.Summoner[Box[P], Children.Varargs]): Component[P, s.CT] = - HookMacros.renderDebugC1Workaround[P, s.CT](self, f, s) + HookMacros.renderDebug1C[P, s.CT](self, f, s) + + inline def renderRRReusable[A](inline f: (P, PropsChildren) => Reusable[A])(implicit inline s: CtorType.Summoner[Box[P], Children.Varargs], inline v: A => VdomNode): Component[P, s.CT] = + HookMacros.renderReusable1C[P, A, s.CT](self, f, s, v) - inline def renderRRReusable[A](f: (P, PropsChildren) => Reusable[A])(implicit s: CtorType.Summoner[Box[P], Children.Varargs], v: A => VdomNode): Component[P, s.CT] = - renderReusable(f) // TODO: use macro + inline def renderRRReusableDebug[A](inline f: (P, PropsChildren) => Reusable[A])(implicit inline s: CtorType.Summoner[Box[P], Children.Varargs], inline v: A => VdomNode): Component[P, s.CT] = + HookMacros.renderReusableDebug1C[P, A, s.CT](self, f, s, v) - inline def renderRRWithReuse(f: (P, PropsChildren) => VdomNode)(implicit s: CtorType.Summoner[Box[P], Children.Varargs], r: Reusability[Ctx]): Component[P, s.CT] = - renderWithReuse(f) // TODO: use macro + inline def renderRRWithReuse(inline f: (P, PropsChildren) => VdomNode)(implicit inline s: CtorType.Summoner[Box[P], Children.Varargs], inline r: Reusability[HookCtx.PC0[P]]): Component[P, s.CT] = + HookMacros.renderWithReuse1C[P, s.CT](self, f, s, r) - inline def renderRRWithReuseBy[A](reusableInputs: (P, PropsChildren) => A)(f: A => VdomNode)(implicit s: CtorType.Summoner[Box[P], Children.Varargs], r: Reusability[A]): Component[P, s.CT] = - renderWithReuseBy(reusableInputs)(f) // TODO: use macro + inline def renderRRWithReuseDebug(inline f: (P, PropsChildren) => VdomNode)(implicit inline s: CtorType.Summoner[Box[P], Children.Varargs], inline r: Reusability[HookCtx.PC0[P]]): Component[P, s.CT] = + HookMacros.renderWithReuseDebug1C[P, s.CT](self, f, s, r) + + inline def renderRRWithReuseBy[A](inline reusableInputs: (P, PropsChildren) => A)(inline f: A => VdomNode)(implicit inline s: CtorType.Summoner[Box[P], Children.Varargs], inline r: Reusability[A]): Component[P, s.CT] = + HookMacros.renderWithReuseBy1C[P, A, s.CT](self, reusableInputs, f, s, r) + + inline def renderRRWithReuseByDebug[A](inline reusableInputs: (P, PropsChildren) => A)(inline f: A => VdomNode)(implicit inline s: CtorType.Summoner[Box[P], Children.Varargs], inline r: Reusability[A]): Component[P, s.CT] = + HookMacros.renderWithReuseByDebug1C[P, A, s.CT](self, reusableInputs, f, s, r) } } @@ -77,26 +96,54 @@ object ApiSecondaryWithRenderMacros { extension [P, C <: Children, Ctx, CtxFn[_], Step <: SubsequentStep[Ctx, CtxFn]](inline self: ApiSecondaryWithRenderMacros[P, C, Ctx, CtxFn, Step]) { inline def renderRR(inline f: CtxFn[VdomNode])(implicit inline step: Step, inline s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = - HookMacros.render2Workaround[P, C, Ctx, CtxFn, Step, s.CT](self, f, step, s) + HookMacros.render2[P, C, Ctx, CtxFn, Step, s.CT](self, f, step, s) inline def renderRRDebug(inline f: CtxFn[VdomNode])(implicit inline step: Step, inline s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = - HookMacros.renderDebug2Workaround[P, C, Ctx, CtxFn, Step, s.CT](self, f, step, s) + HookMacros.renderDebug2[P, C, Ctx, CtxFn, Step, s.CT](self, f, step, s) + + inline def renderRRReusable[A](inline f: CtxFn[Reusable[A]])(implicit inline step: Step, inline s: CtorType.Summoner[Box[P], C], inline v: A => VdomNode): Component[P, s.CT] = + HookMacros.renderReusable2[P, C, A, Ctx, CtxFn, Step, s.CT](self, f, step, s, v) + + inline def renderRRReusableDebug[A](inline f: CtxFn[Reusable[A]])(implicit inline step: Step, inline s: CtorType.Summoner[Box[P], C], inline v: A => VdomNode): Component[P, s.CT] = + HookMacros.renderReusableDebug2[P, C, A, Ctx, CtxFn, Step, s.CT](self, f, step, s, v) + inline def renderRRWithReuse(inline f: CtxFn[VdomNode])(implicit inline step: Step, inline s: CtorType.Summoner[Box[P], C], inline r: Reusability[Ctx]): Component[P, s.CT] = + HookMacros.renderWithReuse2[P, C, Ctx, CtxFn, Step, s.CT](self, f, step, s, r) + + inline def renderRRWithReuseDebug(inline f: CtxFn[VdomNode])(implicit inline step: Step, inline s: CtorType.Summoner[Box[P], C], inline r: Reusability[Ctx]): Component[P, s.CT] = + HookMacros.renderWithReuseDebug2[P, C, Ctx, CtxFn, Step, s.CT](self, f, step, s, r) + + inline def renderRRWithReuseBy[A](inline reusableInputs: CtxFn[A])(inline f: A => VdomNode)(implicit inline step: Step, inline s: CtorType.Summoner[Box[P], C], inline r: Reusability[A]): Component[P, s.CT] = + HookMacros.renderWithReuseBy2[P, C, A, Ctx, CtxFn, Step, s.CT](self, reusableInputs, f, step, s, r) + + inline def renderRRWithReuseByDebug[A](inline reusableInputs: CtxFn[A])(inline f: A => VdomNode)(implicit inline step: Step, inline s: CtorType.Summoner[Box[P], C], inline r: Reusability[A]): Component[P, s.CT] = + HookMacros.renderWithReuseByDebug2[P, C, A, Ctx, CtxFn, Step, s.CT](self, reusableInputs, f, step, s, r) + + // ----------------------------------------------------------------------------------------------- // Gotta duplicate the primary extensions below due to the way Scala 3 handles overload resolution inline def renderRR(inline f: Ctx => VdomNode)(implicit inline s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = - HookMacros.render1Workaround[P, C, Ctx, Step, s.CT](self, f, s) + HookMacros.render1[P, C, Ctx, Step, s.CT](self, f, s) inline def renderRRDebug(inline f: Ctx => VdomNode)(implicit inline s: CtorType.Summoner[Box[P], C]): Component[P, s.CT] = - HookMacros.renderDebug1Workaround[P, C, Ctx, Step, s.CT](self, f, s) + HookMacros.renderDebug1[P, C, Ctx, Step, s.CT](self, f, s) + + inline def renderRRReusable[A](inline f: Ctx => Reusable[A])(implicit s: CtorType.Summoner[Box[P], C], inline v: A => VdomNode): Component[P, s.CT] = + HookMacros.renderReusable1[P, C, A, Ctx, Step, s.CT](self, f, s, v) + + inline def renderRRReusableDebug[A](inline f: Ctx => Reusable[A])(implicit s: CtorType.Summoner[Box[P], C], inline v: A => VdomNode): Component[P, s.CT] = + HookMacros.renderReusableDebug1[P, C, A, Ctx, Step, s.CT](self, f, s, v) + + inline def renderRRWithReuse(inline f: Ctx => VdomNode)(implicit inline s: CtorType.Summoner[Box[P], C], inline r: Reusability[Ctx]): Component[P, s.CT] = + HookMacros.renderWithReuse1[P, C, Ctx, Step, s.CT](self, f, s, r) - inline def renderRRReusable[A](f: CtxFn[Reusable[A]])(implicit step: Step, s: CtorType.Summoner[Box[P], C], v: A => VdomNode): Component[P, s.CT] = - renderReusable(step.squash(f)(_)) // TODO: use macro + inline def renderRRWithReuseDebug(inline f: Ctx => VdomNode)(implicit inline s: CtorType.Summoner[Box[P], C], inline r: Reusability[Ctx]): Component[P, s.CT] = + HookMacros.renderWithReuseDebug1[P, C, Ctx, Step, s.CT](self, f, s, r) - inline def renderRRWithReuse(f: CtxFn[VdomNode])(implicit step: Step, s: CtorType.Summoner[Box[P], C], r: Reusability[Ctx]): Component[P, s.CT] = - renderWithReuse(step.squash(f)(_)) // TODO: use macro + inline def renderRRWithReuseBy[A](inline reusableInputs: Ctx => A)(inline f: A => VdomNode)(implicit inline s: CtorType.Summoner[Box[P], C], inline r: Reusability[A]): Component[P, s.CT] = + HookMacros.renderWithReuseBy1[P, C, A, Ctx, Step, s.CT](self, reusableInputs, f, s, r) - inline def renderRRWithReuseBy[A](reusableInputs: CtxFn[A])(f: A => VdomNode)(implicit step: Step, s: CtorType.Summoner[Box[P], C], r: Reusability[A]): Component[P, s.CT] = - renderWithReuseBy(step.squash(reusableInputs)(_))(f) // TODO: use macro + inline def renderRRWithReuseByDebug[A](inline reusableInputs: Ctx => A)(inline f: A => VdomNode)(implicit inline s: CtorType.Summoner[Box[P], C], inline r: Reusability[A]): Component[P, s.CT] = + HookMacros.renderWithReuseByDebug1[P, C, A, Ctx, Step, s.CT](self, reusableInputs, f, s, r) } } diff --git a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala index f1b279d56..afe332acb 100644 --- a/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala +++ b/library/coreGeneric/src/main/scala/japgolly/scalajs/react/hooks/AbstractHookMacros.scala @@ -15,8 +15,8 @@ import scala.reflect.ClassTag import scala.scalajs.js import scala.scalajs.js.| -/* Coverage - * ======== +/* Coverage: render + * ================ * * - P * - behaviour tested in HooksRRTest.testProps() @@ -41,8 +41,91 @@ import scala.scalajs.js.| * - CtxFn(P, PC) * - behaviour tested in HooksRRTest.testPropsChildrenCtxFn() * - react-refresh integration tested in HooksWithChildrenCtxFn + * + * + * Coverage: renderReusable + * ======================== + * + * - P + * - behaviour tested in HooksRRTest.xxxxx() + * - react-refresh integration tested in RenderReusable.P + * + * - CtxObj(P) + * - behaviour tested in HooksRRTest.xxxxx() + * - react-refresh integration tested in RenderReusable.CtxObj_P + * + * - CtxFn(P) + * - behaviour tested in HooksRRTest.xxxxx() + * - react-refresh integration tested in RenderReusable.CtxFn_P + * + * - (P, PC) + * - behaviour tested in HooksRRTest.xxxxx() + * - react-refresh integration tested in RenderReusable.P_PC + * + * - CtxObj(P, PC) + * - behaviour tested in HooksRRTest.xxxxx() + * - react-refresh integration tested in RenderReusable.CtxObj_P_PC + * + * - CtxFn(P, PC) + * - behaviour tested in HooksRRTest.xxxxx() + * - react-refresh integration tested in RenderReusable.CtxFn_P_PC + * + * + * Coverage: renderWithReuse + * ========================= + * + * - P + * - behaviour tested in HooksRRTest.testRenderWithReuseNever() + * - react-refresh integration tested in RenderWithReuse.P + * + * - CtxObj(P) + * - behaviour tested in HooksRRTest.testRenderWithReuseAndUseRef() + * - react-refresh integration tested in RenderWithReuse.CtxObj_P + * + * - CtxFn(P) + * - behaviour tested in HooksRRTest.testRenderWithReuse() + * - react-refresh integration tested in RenderWithReuse.CtxFn_P + * + * - (P, PC) + * - behaviour tested in HooksRRTest.testRenderWithReuseNeverPC() + * - react-refresh integration tested in RenderWithReuse.P_PC + * + * - CtxObj(P, PC) + * - behaviour tested in HooksRRTest.testRenderWithReuseAndUseRefToVdomO() + * - react-refresh integration tested in RenderWithReuse.CtxObj_P_PC + * + * - CtxFn(P, PC) + * - behaviour tested in HooksRRTest.testRenderWithReuseAndUseRefToVdom() + * - react-refresh integration tested in RenderWithReuse.CtxFn_P_PC + * + * + * Coverage: renderWithReuseBy + * =========================== + * + * - P + * - behaviour tested in HooksRRTest.testRenderWithReuseByNever() + * - react-refresh integration tested in RenderWithReuseBy.P + * + * - CtxObj(P) + * - behaviour tested in HooksRRTest.testRenderWithReuseByAndUseRef() + * - react-refresh integration tested in RenderWithReuseBy.CtxObj_P + * + * - CtxFn(P) + * - behaviour tested in HooksRRTest.testRenderWithReuseBy() + * - react-refresh integration tested in RenderWithReuseBy.CtxFn_P + * + * - (P, PC) + * - behaviour tested in HooksRRTest.testRenderWithReuseByNeverPC() + * - react-refresh integration tested in RenderWithReuseBy.P_PC + * + * - CtxObj(P, PC) + * - behaviour tested in HooksRRTest.testRenderWithReuseByAndUseRefToVdomO() + * - react-refresh integration tested in RenderWithReuseBy.CtxObj_P_PC + * + * - CtxFn(P, PC) + * - behaviour tested in HooksRRTest.testRenderWithReuseByAndUseRefToVdom() + * - react-refresh integration tested in RenderWithReuseBy.CtxFn_P_PC */ - object AbstractHookMacros { final case class HookDefn[Term, TypeTree](steps: Vector[HookStep[Term, TypeTree]]) { @@ -51,6 +134,7 @@ object AbstractHookMacros { } final case class HookStep[Term, TypeTree](name: String, targs: List[TypeTree], args: List[List[Term]]) { + def desc = name def sig = (targs, args) } @@ -69,13 +153,13 @@ object AbstractHookMacros { // Avoid shadowing in Scala 2. final val hookValPrefix = "__japgolly__" - sealed trait HookRewriter[Stmt, Term <: Stmt, Ref] { + sealed trait HookRewriter[Stmt, Term <: Stmt, Type, Ref] { val bridge : HookRewriter.Bridge[Stmt, Term, Ref] protected val hookNo : Int - protected val initialCtx : HookRewriter.InitialCtx[Stmt, Term] + protected val initialCtx : HookRewriter.InitialCtx[Stmt, Term, Type] protected def initialStmts: Vector[Stmt] - protected val prevHooks : List[Term] - protected val usesChildren: Boolean + protected val prevHooks : List[Term] // excludes discarded hooks + val usesChildren: Boolean private var _stmts: Vector[Stmt] = initialStmts @@ -92,13 +176,13 @@ object AbstractHookMacros { final def args: List[Term] = if (usesChildren) - initialCtx.props :: initialCtx.children :: prevHooks + props :: children :: prevHooks else - initialCtx.props :: prevHooks + props :: prevHooks final def argsOrCtxArg(paramCount: Int): List[Term] = { val takesHookCtx = ( - prevHooks.nonEmpty // HookCtx only provided when previous hook results exist + ctxContainsHookResults // HookCtx only provided when previous hook results exist && paramCount == 1 // Function argument takes a single param ) if (takesHookCtx) @@ -107,6 +191,9 @@ object AbstractHookMacros { args } + @inline final def children = + initialCtx.children + final lazy val ctxArg: Term = { val create = bridge.hookCtx(usesChildren, args) val ctx = valDef(create, "_ctx") @@ -130,8 +217,20 @@ object AbstractHookMacros { final def createRaw(body: Term, isLazy: Boolean = false): Ref = valDef(body, "_raw", isLazy = isLazy) - @inline final def isScala2 = bridge.isScala2 - @inline final def isScala3 = bridge.isScala3 + final def ctxContainsHookResults: Boolean = + prevHooks.nonEmpty + + @inline final def ctxType = + initialCtx.ctxType + + @inline final def isScala2 = + bridge.isScala2 + + @inline final def isScala3 = + bridge.isScala3 + + @inline final def props = + initialCtx.props final def stmts() = _stmts @@ -145,7 +244,7 @@ object AbstractHookMacros { object HookRewriter { - final case class InitialCtx[Stmt, Term](props: Term, initChildren: Stmt, children: Term) + final case class InitialCtx[Stmt, Term, Type](props: Term, initChildren: Stmt, children: Term, ctxType: Type) final case class Bridge[Stmt, Term, Ref]( apply : (Term, List[Term]) => Term, @@ -158,36 +257,36 @@ object AbstractHookMacros { @inline def isScala3 = scalaVer == 3 } - def start[Stmt, Term <: Stmt, Ref](ctx : InitialCtx[Stmt, Term], - bridg : Bridge[Stmt, Term, Ref], - useChildren: Boolean): HookRewriter[Stmt, Term, Ref] = - new HookRewriter[Stmt, Term, Ref] { + def start[Stmt, Term <: Stmt, Type, Ref](ctx : InitialCtx[Stmt, Term, Type], + bridg : Bridge[Stmt, Term, Ref], + useChildren: Boolean): HookRewriter[Stmt, Term, Type, Ref] = + new HookRewriter[Stmt, Term, Type, Ref] { override val bridge = bridg override protected val hookNo = 1 override protected val initialCtx = ctx override protected def initialStmts = if (useChildren) Vector(ctx.initChildren) else Vector.empty override protected val prevHooks = Nil - override protected val usesChildren = useChildren + override val usesChildren = useChildren } - def next[Stmt, Term <: Stmt, Ref](prev: HookRewriter[Stmt, Term, Ref])(newHook: Option[Ref]): HookRewriter[Stmt, Term, Ref] = - new HookRewriter[Stmt, Term, Ref] { + def next[Stmt, Term <: Stmt, Type, Ref](prev: HookRewriter[Stmt, Term, Type, Ref])(newHook: Option[Ref]): HookRewriter[Stmt, Term, Type, Ref] = + new HookRewriter[Stmt, Term, Type, Ref] { override val bridge = prev.bridge override protected val hookNo = prev.hookNo + 1 override protected val initialCtx = prev.initialCtx override protected def initialStmts = prev.stmts() override protected val prevHooks = newHook.fold(prev.prevHooks)(prev.prevHooks :+ prev.bridge.refToTerm(_)) - override protected val usesChildren = prev.usesChildren + override val usesChildren = prev.usesChildren } - def end[Stmt, Term <: Stmt, Ref](prev: HookRewriter[Stmt, Term, Ref]): HookRewriter[Stmt, Term, Ref] = - new HookRewriter[Stmt, Term, Ref] { + def end[Stmt, Term <: Stmt, Type, Ref](prev: HookRewriter[Stmt, Term, Type, Ref]): HookRewriter[Stmt, Term, Type, Ref] = + new HookRewriter[Stmt, Term, Type, Ref] { override val bridge = prev.bridge override protected val hookNo = -1 override protected val initialCtx = prev.initialCtx override protected def initialStmts = prev.stmts() override protected val prevHooks = prev.prevHooks - override protected val usesChildren = prev.usesChildren + override val usesChildren = prev.usesChildren } } } @@ -246,15 +345,15 @@ trait AbstractHookMacros { final type HookDefn = AbstractHookMacros.HookDefn[Term, TypeTree] final type HookStep = AbstractHookMacros.HookStep[Term, TypeTree] - final type Rewriter = HookRewriter[Stmt, Term, Ref] + final type Rewriter = HookRewriter[Stmt, Term, TypeTree, Ref] final type RewriterBridge = HookRewriter.Bridge[Stmt, Term, Ref] - final type RewriterCtx = HookRewriter.InitialCtx[Stmt, Term] + final type RewriterCtx = HookRewriter.InitialCtx[Stmt, Term, TypeTree] final implicit val log: MacroLogger = MacroLogger() - final def rewriterCtx(props: Term, initChildren: Stmt, children: Term): RewriterCtx = - HookRewriter.InitialCtx(props, initChildren, children) + final def rewriterCtx(props: Term, initChildren: Stmt, children: Term, ctxType: TypeTree): RewriterCtx = + HookRewriter.InitialCtx(props, initChildren, children, ctxType) protected object AutoTypeImplicits { @inline implicit def autoTerm[A](e: Expr[A]): Term = asTerm(e) @@ -326,7 +425,7 @@ trait AbstractHookMacros { val renderStep = h.steps.last for { - hookFns <- traverseVector(hookSteps)(rewriteStep) + hookFns <- traverseVector(hookSteps)(rewriteStep(_)) renderFn <- rewriteRender(renderStep) } yield rctx => { val r0 = HookRewriter.start(rctx, rewriterBridge, withPropsChildren) @@ -340,27 +439,45 @@ trait AbstractHookMacros { } // ------------------------------------------------------------------------------------------------------------------- - def rewriteStep(step: HookStep): Either[() => String, Rewriter => Option[Ref]] = { - log("rewriteStep:" + step.name, step) + // Rewriting util - def by[A](fn: Term, betaReduce: Rewriter => Boolean = null)(use: (Rewriter, Term => Term) => A): Either[() => String, Rewriter => A] = - fn match { - case FunctionLike(paramCount) => - Right { b => - val args = b.argsOrCtxArg(paramCount) - val br = if (betaReduce eq null) true else betaReduce(b) - use(b, call(_, args, br)) - } + private def by[A](fn: Term, betaReduce: Rewriter => Boolean = null)(use: (Rewriter, Term => Term) => A) + (implicit step: HookStep): Either[() => String, Rewriter => A] = + uninline(fn) match { + case FunctionLike(paramCount) => + Right { b => + val args = b.argsOrCtxArg(paramCount) + val br = if (betaReduce eq null) true else betaReduce(b) + use(b, call(_, args, br)) + } - case _ => - Left(() => s"Expected a function, found: ${showRaw(fn)}") - } + case _ => + Left(() => s"Expected a function in ${step.desc}, found: ${showRaw(fn)}") + } - def maybeBy[A](f: Term, betaReduce: Rewriter => Boolean = null)(use: (Rewriter, Term => Term) => A): Either[() => String, Rewriter => A] = - if (step.name endsWith "By") - by(f, betaReduce = betaReduce)(use) - else - Right(use(_, identity)) + private def maybeBy[A](f: Term, betaReduce: Rewriter => Boolean = null)(use: (Rewriter, Term => Term) => A) + (implicit step: HookStep): Either[() => String, Rewriter => A] = + if (step.name endsWith "By") + by(f, betaReduce = betaReduce)(use) + else + Right(use(_, identity)) + + private def reusableDeps[D](b: Rewriter, depsExpr: Expr[D], reuse: Expr[Reusability[D]], tpeD: Type[D], depsVal: Boolean = true): (Expr[D], Expr[Int]) = { + import AutoTypeImplicits._ + type DS = ReusableDepState[D] + val tpeODS = optionType(reusableDepStateType(tpeD)) + val stateRaw = b.valDef(useStateValue[Option[DS]](tpeODS, none(tpeODS)), "_state_raw") + val state = b.valDef(useStateFromJsBoxed[Option[DS]](tpeODS, stateRaw), "_state") + val newDeps = if (depsVal) autoRefToExpr[D](b.valDef(depsExpr, "_deps")) else depsExpr + val rds = b.valDef(reusableDepsLogic[D](newDeps, state, reuse, tpeD), "_deps_state") + val deps = reusableDepStateValue(rds, tpeD) + val rev = reusableDepStateRev(rds) + (deps, rev) + } + + // ------------------------------------------------------------------------------------------------------------------- + def rewriteStep(implicit step: HookStep): Either[() => String, Rewriter => Option[Ref]] = { + log("rewriteStep:" + step.name, step) import AutoTypeImplicits._ type F[A] = List[A] @@ -381,18 +498,6 @@ trait AbstractHookMacros { b.createHook(hook) } - def reusableDeps[D](b: Rewriter, depsExpr: Expr[D], reuse: Expr[Reusability[D]], tpeD: Type[D]): (Expr[D], Expr[Int]) = { - type DS = ReusableDepState[D] - val tpeODS = optionType(reusableDepStateType(tpeD)) - val stateRaw = b.valDef(useStateValue[Option[DS]](tpeODS, none(tpeODS)), "_state_raw") - val state = b.valDef(useStateFromJsBoxed[Option[DS]](tpeODS, stateRaw), "_state") - val newDeps = b.valDef(depsExpr, "_deps") - val rds = b.valDef(reusableDepsLogic[D](newDeps, state, reuse, tpeD), "_deps_state") - val deps = reusableDepStateValue(rds, tpeD) - val rev = reusableDepStateRev(rds) - (deps, rev) - } - def reusableByDeps[D, A](b: Rewriter, depsExpr: Expr[D], reuse: Expr[Reusability[D]], tpeD: Type[D], tpeA: Type[A]) (create: (Expr[D], Expr[Int]) => Expr[A]): Expr[Reusable[A]] = { val (deps, rev) = reusableDeps[D](b, depsExpr, reuse, tpeD) @@ -410,7 +515,7 @@ trait AbstractHookMacros { Some(r) def fail = - Left(() => s"Inlining of hook method '${step.name}' not yet supported.") + Left(() => s"Inlining of '${step.desc}' not yet supported.") step.name match { @@ -751,26 +856,103 @@ trait AbstractHookMacros { protected def vdomRawNode: Expr[VdomNode] => Expr[React.Node] // ------------------------------------------------------------------------------------------------------------------- - def rewriteRender(step: HookStep): Either[() => String, Rewriter => Term] = { + private def rewriteRender(implicit step: HookStep): Either[() => String, Rewriter => Term] = { log("rewriteRender:" + step.name, step) - step.name match { - case "renderRR" | "renderRRDebug" => - val List(List(fn), _) = step.args : @nowarn + def withParamCount(fn: Term): Either[() => String, Int] = uninline(fn) match { - case FunctionLike(paramCount) => - Right { b => - val args = b.argsOrCtxArg(paramCount) - call(fn, args, true) - } + case FunctionLike(paramCount) => Right(paramCount) + case f => Left(() => s"Expected a function in ${step.desc}, found: ${showRaw(f)}") + } + + import AutoTypeImplicits._ + + def shouldComponentUpdate[D](b: Rewriter, depsExpr: Expr[D], render: Expr[D => VdomNode], reuse: Expr[Reusability[D]], tpe: Type[D]): Expr[VdomNode] = { + val (deps, rev) = reusableDeps[D](b, depsExpr, reuse, tpe, depsVal = false) + val body = call(render, deps :: Nil, true) + shouldComponentUpdateComponent(rev, body) + } + + trait Ctx + trait D + + def fail = + Left(() => s"Inlining of '${step.desc}' not yet supported.") + + step.name.stripSuffix("Debug") match { + + case "renderRR" => + val List(List(fn), _) = step.args : @nowarn + withParamCount(fn).map { paramCount => b => + val args = b.argsOrCtxArg(paramCount) + call(fn, args, true) + } + + case "renderRRReusable" => + val (List(tpe), List(List(renderFn), implicits)) = step.sig : @nowarn + val implicitCount = implicits.size + withParamCount(renderFn).map { paramCount => b => + val mkVdom = implicits.last + val reusableA = call(renderFn, b.argsOrCtxArg(paramCount), true) + val tpeV = vdomNodeType + val tpeRV = reusableType[VdomNode](tpeV) + val reusableV = reusableMap[D, VdomNode](reusableA, mkVdom, tpe, tpeV) + val reuse = reusabilityReusable[VdomNode](tpeV) + val (deps, rev) = reusableDeps[Reusable[VdomNode]](b, reusableV, reuse, tpeRV) + val body = reusableValue[VdomNode](deps, tpeV) + shouldComponentUpdateComponent(rev, body) + } - case _ => - Left(() => s"Expected a function, found: ${showRaw(fn)}") + case "renderRRWithReuse" => + val List(List(renderFn), implicits) = step.args : @nowarn + val implicitCount = implicits.size + withParamCount(renderFn).map { paramCount => b => + val reuse = implicits.last + val ctx = if (paramCount == 1 && !b.ctxContainsHookResults) b.props else b.ctxArg + val (deps, rev) = reusableDeps[Ctx](b, ctx, reuse, b.ctxType, depsVal = false) + // log(s"paramCount = $paramCount, implicitCount = $implicitCount, usesChildren = ${b.usesChildren}, ctxContainsHookResults = ${b.ctxContainsHookResults}") + val renderArgs: List[Term] = + if (implicitCount == 3) + b.argsOrCtxArg(paramCount) + else if (b.usesChildren && paramCount == 2) + b.props :: b.children :: Nil + else if (b.ctxContainsHookResults) + deps :: Nil + else + b.props :: Nil + val body = call(renderFn, renderArgs, true) + shouldComponentUpdateComponent(rev, body) + } + + case "renderRRWithReuseBy" => + val List(tpe) = step.targs : @nowarn + val List(List(reusableInputs), List(renderFn), implicits) = step.args : @nowarn + by(reusableInputs) { (b, withCtx) => + val reuse = implicits.last + val deps: Expr[D] = + if (b.ctxContainsHookResults) + withCtx(reusableInputs) + else if (b.usesChildren) + call(reusableInputs, b.props :: b.children :: Nil, true) + else + call(reusableInputs, b.props :: Nil, true) + shouldComponentUpdate[D](b, deps, renderFn, reuse, tpe) } case _ => - Left(() => s"Inlining of render method '${step.name}' not yet supported.") + fail } } + protected def reusabilityReusable[A]: Type[A] => Expr[Reusability[Reusable[A]]] + + protected def reusableMap[A, B]: (Expr[Reusable[A]], Expr[A => B], Type[A], Type[B]) => Expr[Reusable[B]] + + protected def reusableType[A]: Type[A] => Type[Reusable[A]] + + protected def reusableValue[A]: (Expr[Reusable[A]], Type[A]) => Expr[A] + + protected def shouldComponentUpdateComponent: (Expr[Int], Expr[VdomNode]) => Expr[VdomNode] + + protected def vdomNodeType: Type[VdomNode] } diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala index 822cef1bd..36462a56c 100644 --- a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/Main.scala @@ -23,6 +23,9 @@ object Main { HooksWithScalaFns .Component(0), JustPropsChildrenViaHookApi.Component(0)(<.div), JustPropsViaHookApi .Component(0), + RenderReusable .all(PI(987)), + RenderWithReuse .all(PI(123)), + RenderWithReuseBy .all(PI(456)), UseCallback .Component(0), UseEffect .Component(0), UseMemo .Component(0), diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/PI.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/PI.scala new file mode 100644 index 000000000..8761462ff --- /dev/null +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/PI.scala @@ -0,0 +1,15 @@ +package japgolly.scalajs.react.test.emissions + +import japgolly.scalajs.react._ + +final case class PI(pi: Int) { + def unary_- : PI = PI(-pi) + def *(n: Int): PI = PI(pi * n) + def +(n: Int): PI = PI(pi + n) + def +(n: PI): PI = PI(pi + n.pi) +} + +object PI { + implicit val reusability: Reusability[PI] = + Reusability.by[PI, Int](_.pi >> 1) +} \ No newline at end of file diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/RenderReusable.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/RenderReusable.scala new file mode 100644 index 000000000..01c3dcd87 --- /dev/null +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/RenderReusable.scala @@ -0,0 +1,90 @@ +package japgolly.scalajs.react.test.emissions + +import japgolly.scalajs.react._ +import japgolly.scalajs.react.hooks.HookCtx +import japgolly.scalajs.react.vdom.html_<^._ +import org.scalajs.dom.html.Input + +object RenderReusable { + + def all = ScalaFnComponent[PI] { p => + <.div( + P (p), + CtxObj_P (), + CtxFn_P (p), + P_PC (p)(1), + CtxObj_P_PC(2), + CtxFn_P_PC (3), + ) + } + + val P = + ScalaFnComponent.withHooks[PI] + .renderRRReusable(p => Reusable.implicitly(p.toString)) + + val CtxObj_P = + ScalaFnComponent.withHooks[Unit] + .useRef(100) + .useState(0) + .renderRRReusable { $ => + val ref = $.hook1 + val s = $.hook2 + Reusable.never( + <.div( + ref.value, + <.button(^.onClick --> ref.mod(_ + 1)), + <.button(^.onClick --> s.modState(_ + 1)), + ) + ) + } + + val CtxFn_P = + ScalaFnComponent.withHooks[PI] + .useState(20) + .useCallback(Callback.log("asd")) + .useForceUpdate + .renderRRReusable { (p, s, incES, fu) => + Reusable.never( + <.div( + s"P=$p, S=${s.value}", + <.button(^.onClick --> s.modState(_ + 1)), + <.button(^.onClick --> (incES >> fu)), + ) + ) + } + + val P_PC = + ScalaFnComponent.withHooks[PI] + .withPropsChildren + .renderRRReusable { (p, c) => + Reusable.always(<.div(s"P=$p", c)) + } + + val CtxObj_P_PC = + ScalaFnComponent.withHooks[Unit] + .withPropsChildren + .useRefToVdom[Input] + .useState("x") + .renderRRReusable { $ => + val c = $.propsChildren + val inputRef = $.hook1 + val s = $.hook2 + def onChange(e: ReactEventFromInput): Callback = s.setState(e.target.value) + Reusable.never( + <.div(<.input.text.withRef(inputRef)(^.value := s.value, ^.onChange ==> onChange), c) + ) + } + + val CtxFn_P_PC = + ScalaFnComponent.withHooks[Unit] + .withPropsChildren + .useRefToVdom[Input] + .useState("x") + .renderRRReusable { (_, c, inputRef, s) => + def onChange(e: ReactEventFromInput): Callback = s.setState(e.target.value) + Reusable.never( + <.div(<.input.text.withRef(inputRef)(^.value := s.value, ^.onChange ==> onChange), c) + ) + } + +} diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/RenderWithReuse.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/RenderWithReuse.scala new file mode 100644 index 000000000..c6d19d035 --- /dev/null +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/RenderWithReuse.scala @@ -0,0 +1,82 @@ +package japgolly.scalajs.react.test.emissions + +import japgolly.scalajs.react._ +import japgolly.scalajs.react.hooks.HookCtx +import japgolly.scalajs.react.vdom.html_<^._ +import org.scalajs.dom.html.Input + +object RenderWithReuse { + + def all = ScalaFnComponent[PI] { p => + <.div( + P (p), + CtxObj_P (), + CtxFn_P (p), + P_PC (p)(1), + CtxObj_P_PC(2), + CtxFn_P_PC (3), + ) + } + + val P = + ScalaFnComponent.withHooks[PI] + .renderRRWithReuse(_.toString) + + val CtxObj_P = + ScalaFnComponent.withHooks[Unit] + .useRef(100) + .useState(0) + .renderRRWithReuse { $ => + val ref = $.hook1 + val s = $.hook2 + <.div( + ref.value, + <.button(^.onClick --> ref.mod(_ + 1)), + <.button(^.onClick --> s.modState(_ + 1)), + ) + } + + val CtxFn_P = + ScalaFnComponent.withHooks[PI] + .useState(20) + .useCallback(Callback.log("asd")) + .useForceUpdate + .renderRRWithReuse { (p, s, incES, fu) => + <.div( + s"P=$p, S=${s.value}", + <.button(^.onClick --> s.modState(_ + 1)), + <.button(^.onClick --> (incES >> fu)), + ) + } + + val P_PC = + ScalaFnComponent.withHooks[PI] + .withPropsChildren + .renderRRWithReuse { (p, c) => + <.div(s"P=$p", c) + } + + val CtxObj_P_PC = + ScalaFnComponent.withHooks[Unit] + .withPropsChildren + .useRefToVdom[Input] + .useState("x") + .renderRRWithReuse { $ => + val c = $.propsChildren + val inputRef = $.hook1 + val s = $.hook2 + def onChange(e: ReactEventFromInput): Callback = s.setState(e.target.value) + <.div(<.input.text.withRef(inputRef)(^.value := s.value, ^.onChange ==> onChange), c) + } + + val CtxFn_P_PC = + ScalaFnComponent.withHooks[Unit] + .withPropsChildren + .useRefToVdom[Input] + .useState("x") + .renderRRWithReuse { (_, c, inputRef, s) => + def onChange(e: ReactEventFromInput): Callback = s.setState(e.target.value) + <.div(<.input.text.withRef(inputRef)(^.value := s.value, ^.onChange ==> onChange), c) + } + +} diff --git a/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/RenderWithReuseBy.scala b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/RenderWithReuseBy.scala new file mode 100644 index 000000000..c7e2cf8be --- /dev/null +++ b/library/testEmissions/js/src/main/scala/japgolly/scalajs/react/test/emissions/RenderWithReuseBy.scala @@ -0,0 +1,82 @@ +package japgolly.scalajs.react.test.emissions + +import japgolly.scalajs.react._ +import japgolly.scalajs.react.hooks.HookCtx +import japgolly.scalajs.react.vdom.html_<^._ +import org.scalajs.dom.html.Input + +object RenderWithReuseBy { + + def all = ScalaFnComponent[PI] { p => + <.div( + P (p), + CtxObj_P (), + CtxFn_P (p), + P_PC (p)(1), + CtxObj_P_PC(2), + CtxFn_P_PC (3), + ) + } + + val P = + ScalaFnComponent.withHooks[PI] + .renderRRWithReuseBy(_ + 1)(_.toString) + + val CtxObj_P = + ScalaFnComponent.withHooks[Unit] + .useRef(100) + .useState(0) + .renderRRWithReuseBy(c => c) { $ => + val ref = $.hook1 + val s = $.hook2 + <.div( + ref.value, + <.button(^.onClick --> ref.mod(_ + 1)), + <.button(^.onClick --> s.modState(_ + 1)), + ) + } + + val CtxFn_P = + ScalaFnComponent.withHooks[PI] + .useState(20) + .useCallback(Callback.log("asd")) + .useForceUpdate + .renderRRWithReuseBy((_, _, _, _)) { case (p, s, incES, fu) => + <.div( + s"P=$p, S=${s.value}", + <.button(^.onClick --> s.modState(_ + 1)), + <.button(^.onClick --> (incES >> fu)), + ) + } + + val P_PC = + ScalaFnComponent.withHooks[PI] + .withPropsChildren + .renderRRWithReuseBy((_, _)) { case (p, c) => + <.div(s"P=$p", c) + } + + val CtxObj_P_PC = + ScalaFnComponent.withHooks[Unit] + .withPropsChildren + .useRefToVdom[Input] + .useState("x") + .renderRRWithReuseBy(c => c) { $ => + val c = $.propsChildren + val inputRef = $.hook1 + val s = $.hook2 + def onChange(e: ReactEventFromInput): Callback = s.setState(e.target.value) + <.div(<.input.text.withRef(inputRef)(^.value := s.value, ^.onChange ==> onChange), c) + } + + val CtxFn_P_PC = + ScalaFnComponent.withHooks[Unit] + .withPropsChildren + .useRefToVdom[Input] + .useState("x") + .renderRRWithReuseBy((_, _, _, _)) { case (_, c, inputRef, s) => + def onChange(e: ReactEventFromInput): Callback = s.setState(e.target.value) + <.div(<.input.text.withRef(inputRef)(^.value := s.value, ^.onChange ==> onChange), c) + } + +} diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/RenderReusable-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/RenderReusable-out2.js new file mode 100644 index 000000000..e2595c5af --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/RenderReusable-out2.js @@ -0,0 +1,455 @@ +'use strict'; + +var _s = $RefreshSig$(), + _s2 = $RefreshSig$(), + _s3 = $RefreshSig$(), + _s4 = $RefreshSig$(), + _s5 = $RefreshSig$(), + _s6 = $RefreshSig$(); + +import * as $i_react from "react"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Children from "./japgolly.scalajs.react.CtorType$Children.js"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Nullary from "./japgolly.scalajs.react.CtorType$Nullary.js"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Props from "./japgolly.scalajs.react.CtorType$Props.js"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024PropsAndChildren from "./japgolly.scalajs.react.CtorType$PropsAndChildren.js"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eNonEmptyRef$0024FullF from "./japgolly.scalajs.react.NonEmptyRef$FullF.js"; +import * as $j_japgolly$002escalajs$002ereact$002ePropsChildren from "./japgolly.scalajs.react.PropsChildren.js"; +import * as $j_japgolly$002escalajs$002ereact$002eRef$0024 from "./japgolly.scalajs.react.Ref$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eRef$0024FullF from "./japgolly.scalajs.react.Ref$FullF.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusability from "./japgolly.scalajs.react.Reusability.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusable from "./japgolly.scalajs.react.Reusable.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eGeneric$0024UnmountedRaw from "./japgolly.scalajs.react.component.Generic$UnmountedRaw.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseCallbackArg$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseRefF from "./japgolly.scalajs.react.hooks.Hooks$UseRefF.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024 from "./japgolly.scalajs.react.internal.ShouldComponentUpdateComponent$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 from "./japgolly.scalajs.react.internal.Singleton$.js"; +import * as $j_japgolly$002escalajs$002ereact$002epackage$0024 from "./japgolly.scalajs.react.package$.js"; +import * as $j_japgolly$002escalajs$002ereact$002etest$002eemissions$002ePI from "./japgolly.scalajs.react.test.emissions.PI.js"; +import * as $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024 from "./japgolly.scalajs.react.util.DefaultEffects$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024 from "./japgolly.scalajs.react.util.EffectCallback$callback$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024 from "./japgolly.scalajs.react.vdom.Attr$EventCallback$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomElement$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode from "./japgolly.scalajs.react.vdom.VdomNode.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_org$002escalajs$002edom$002eHTMLInputElement from "./org.scalajs.dom.HTMLInputElement.js"; +import * as $j_scala$002e$0024less$0024colon$0024less$0024 from "./scala.$less$colon$less$.js"; +import * as $j_scala$002eArray$0024 from "./scala.Array$.js"; +import * as $j_scala$002eFunction1 from "./scala.Function1.js"; +import * as $j_scala$002eNone$0024 from "./scala.None$.js"; +import * as $j_scala$002eSome from "./scala.Some.js"; +import * as $j_scala$002ereflect$002eClassTag$0024GenericClassTag from "./scala.reflect.ClassTag$GenericClassTag.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; +import * as $j_scala$002escalajs$002eruntime$002eWrappedVarArgs from "./scala.scalajs.runtime.WrappedVarArgs.js"; + +function $p_Ljapgolly_scalajs_react_test_emissions_RenderReusable$__onChange$1__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_callback_Trampoline($thiz, e, s$2) { + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var r = $j_japgolly$002escalajs$002ereact$002eReusability.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__setState__Ljapgolly_scalajs_react_Reusable(s$2); + return r.value__O().apply__O__O(e.target.value).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline; +} + +export { $p_Ljapgolly_scalajs_react_test_emissions_RenderReusable$__onChange$1__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_callback_Trampoline }; + +function $p_Ljapgolly_scalajs_react_test_emissions_RenderReusable$__onChange$2__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_callback_Trampoline($thiz, e, __japgolly__hook2$2) { + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var r = $j_japgolly$002escalajs$002ereact$002eReusability.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__setState__Ljapgolly_scalajs_react_Reusable(__japgolly__hook2$2); + return r.value__O().apply__O__O(e.target.value).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline; +} + +export { $p_Ljapgolly_scalajs_react_test_emissions_RenderReusable$__onChange$2__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_callback_Trampoline }; + +function $c_Ljapgolly_scalajs_react_test_emissions_RenderReusable$() { + this.Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_P = null; + this.Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_CtxObj_P = null; + this.Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_CtxFn_P = null; + this.Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_P_PC = null; + this.Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_CtxObj_P_PC = null; + this.Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_CtxFn_P_PC = null; + $n_Ljapgolly_scalajs_react_test_emissions_RenderReusable$ = this; + + var rawComponent = arg1$2 => $m_Ljapgolly_scalajs_react_test_emissions_RenderReusable$().japgolly$scalajs$react$test$emissions$RenderReusable$$$anonfun$P$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2); + + var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$(), null)); + this.Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_P = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$1.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); + + var rawComponent$2 = arg1$2$1 => $m_Ljapgolly_scalajs_react_test_emissions_RenderReusable$().japgolly$scalajs$react$test$emissions$RenderReusable$$$anonfun$CtxObj_P$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2$1); + + var $$x2 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$2 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s$1 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonN__Ljapgolly_scalajs_react_internal_Singleton__Ljapgolly_scalajs_react_CtorType$Summoner($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$().Ljapgolly_scalajs_react_internal_Singleton$__f_BoxUnit); + this.Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_CtxObj_P = $$x2.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$2.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent$2, s$1)); + + var rawComponent$3 = arg1$2$2 => $m_Ljapgolly_scalajs_react_test_emissions_RenderReusable$().japgolly$scalajs$react$test$emissions$RenderReusable$$$anonfun$CtxFn_P$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2$2); + + var $$x3 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$3 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s$2 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$(), null)); + this.Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_CtxFn_P = $$x3.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$3.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent$3, s$2)); + + var rawComponent$4 = arg1$2$3 => $m_Ljapgolly_scalajs_react_test_emissions_RenderReusable$().japgolly$scalajs$react$test$emissions$RenderReusable$$$anonfun$P_PC$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2$3); + + var $$x4 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$4 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s$3 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonPC__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$(), null)); + this.Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_P_PC = $$x4.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$4.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent$4, s$3)); + + var rawComponent$5 = arg1$2$4 => $m_Ljapgolly_scalajs_react_test_emissions_RenderReusable$().japgolly$scalajs$react$test$emissions$RenderReusable$$$anonfun$CtxObj_P_PC$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2$4); + + var $$x5 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$5 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s$4 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonC__Ljapgolly_scalajs_react_internal_Singleton__Ljapgolly_scalajs_react_CtorType$Summoner($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$().Ljapgolly_scalajs_react_internal_Singleton$__f_BoxUnit); + this.Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_CtxObj_P_PC = $$x5.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$5.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent$5, s$4)); + + var rawComponent$6 = arg1$2$5 => $m_Ljapgolly_scalajs_react_test_emissions_RenderReusable$().japgolly$scalajs$react$test$emissions$RenderReusable$$$anonfun$CtxFn_P_PC$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2$5); + + var $$x6 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$6 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s$5 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonC__Ljapgolly_scalajs_react_internal_Singleton__Ljapgolly_scalajs_react_CtorType$Summoner($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$().Ljapgolly_scalajs_react_internal_Singleton$__f_BoxUnit); + this.Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_CtxFn_P_PC = $$x6.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$6.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent$6, s$5)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_RenderReusable$ }; +$c_Ljapgolly_scalajs_react_test_emissions_RenderReusable$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_RenderReusable$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_RenderReusable$; + +function $h_Ljapgolly_scalajs_react_test_emissions_RenderReusable$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_RenderReusable$ }; +$h_Ljapgolly_scalajs_react_test_emissions_RenderReusable$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_RenderReusable$.prototype; + +$c_Ljapgolly_scalajs_react_test_emissions_RenderReusable$.prototype.all__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot = function () { + return $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_ScalaFnComponent.apply__F1__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(p$2 => { + var p = p$2; + var $$x6 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var c = $m_Ljapgolly_scalajs_react_test_emissions_RenderReusable$().Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_P; + var this$5 = c.ctor__Ljapgolly_scalajs_react_CtorType(); + var u = this$5.Ljapgolly_scalajs_react_CtorType$Props__f_construct.apply__O__O__O(p, this$5.Ljapgolly_scalajs_react_CtorType$Props__f_mods); + var n = u.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var $$x5 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n); + var c$1 = $m_Ljapgolly_scalajs_react_test_emissions_RenderReusable$().Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_CtxObj_P; + var u$1 = c$1.ctor__Ljapgolly_scalajs_react_CtorType().apply__O(); + var n$1 = u$1.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var $$x4 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n$1); + var c$2 = $m_Ljapgolly_scalajs_react_test_emissions_RenderReusable$().Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_CtxFn_P; + var this$12 = c$2.ctor__Ljapgolly_scalajs_react_CtorType(); + var u$2 = this$12.Ljapgolly_scalajs_react_CtorType$Props__f_construct.apply__O__O__O(p, this$12.Ljapgolly_scalajs_react_CtorType$Props__f_mods); + var n$2 = u$2.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var $$x3 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n$2); + var c$3 = $m_Ljapgolly_scalajs_react_test_emissions_RenderReusable$().Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_P_PC; + var this$21 = c$3.ctor__Ljapgolly_scalajs_react_CtorType(); + var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(1))]; + var children = new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array); + var u$3 = this$21.Ljapgolly_scalajs_react_CtorType$PropsAndChildren__f_construct.apply__O__O__O__O(p, this$21.Ljapgolly_scalajs_react_CtorType$PropsAndChildren__f_mods, children); + var n$3 = u$3.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var $$x2 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n$3); + var c$4 = $m_Ljapgolly_scalajs_react_test_emissions_RenderReusable$().Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_CtxObj_P_PC; + var this$30 = c$4.ctor__Ljapgolly_scalajs_react_CtorType(); + var array$1 = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(2))]; + var children$1 = new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array$1); + var u$4 = this$30.Ljapgolly_scalajs_react_CtorType$Children__f_construct.apply__O__O__O(this$30.Ljapgolly_scalajs_react_CtorType$Children__f_mods, children$1); + var n$4 = u$4.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var $$x1 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n$4); + var c$5 = $m_Ljapgolly_scalajs_react_test_emissions_RenderReusable$().Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_CtxFn_P_PC; + var this$39 = c$5.ctor__Ljapgolly_scalajs_react_CtorType(); + var array$2 = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(3))]; + var children$2 = new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array$2); + var u$5 = this$39.Ljapgolly_scalajs_react_CtorType$Children__f_construct.apply__O__O__O(this$39.Ljapgolly_scalajs_react_CtorType$Children__f_mods, children$2); + var n$5 = u$5.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var array$3 = [$$x5, $$x4, $$x3, $$x2, $$x1, new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n$5)]; + return $$x6.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("div", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array$3)); + }), $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$(), null))); +}; + +$c_Ljapgolly_scalajs_react_test_emissions_RenderReusable$.prototype.japgolly$scalajs$react$test$emissions$RenderReusable$$$anonfun$P$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s(function (props) { + _s(); + + var __japgolly__render_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eNone$0024.$m_s_None$())); + + var __japgolly__render_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw); + + var $$x3 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var $$x2 = $j_java$002elang$002eObject.$dp_toString__T(props.a); + var $$x1 = new $j_scala$002ereflect$002eClassTag$0024GenericClassTag.$c_s_reflect_ClassTag$GenericClassTag($j_java$002elang$002eObject.$d_T.getClassOf()); + var this$2 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + + var __japgolly__render_deps = $$x3.implicitly__O__s_reflect_ClassTag__F2__Ljapgolly_scalajs_react_Reusable($$x2, $$x1, this$2.by_$eq$eq__F2()).map__F1__Ljapgolly_scalajs_react_Reusable(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(v$2 => { + var v = v$2; + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + return new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(v); + })); + + var __japgolly__render_deps_state = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__render_deps, __japgolly__render_state, $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusableReusability__F2()); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => __japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value.value__O())).rawNode__sjs_js_$bar(); +}, "M/diGxSdMncUUNsduOrYE4sj5Xs="); +$c_Ljapgolly_scalajs_react_test_emissions_RenderReusable$.prototype.japgolly$scalajs$react$test$emissions$RenderReusable$$$anonfun$CtxObj_P$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s2(function (props) { + _s2(); + + var __japgolly__hook1_raw = $i_react.useRef(100); + + var this$2 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); + + var __japgolly__hook1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseRefF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseRefF(__japgolly__hook1_raw, this$2.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + + var __japgolly__hook2_raw = $i_react.useState(() => { + $m_Ljapgolly_scalajs_react_test_emissions_RenderReusable$(); + return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(0); + }); + + var __japgolly__hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw); + + props.a; + + var __japgolly__render_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eNone$0024.$m_s_None$())); + + var __japgolly__render_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw); + + var this$24 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var $$x5 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + var v = __japgolly__hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseRefF__f_raw.current | 0; + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + var $$x4 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(v); + var $$x3 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var array = [$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + var f = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$1$2 => { + var x$1 = x$1$2 | 0; + return 1 + x$1 | 0; + }); + return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002eNonEmptyRef$0024FullF.$f_Ljapgolly_scalajs_react_NonEmptyRef$FullF__mod__F1__O(__japgolly__hook1, f).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline); + }), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]; + var $$x2 = $$x3.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("button", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); + var $$x1 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var array$1 = [$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var r = $j_japgolly$002escalajs$002ereact$002eReusability.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(__japgolly__hook2); + return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$2$2 => { + var x$2 = x$2$2 | 0; + return 1 + x$2 | 0; + })).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline); + }), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]; + var array$2 = [$$x4, $$x2, $$x1.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("button", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array$1))]; + var a = $$x5.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("div", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array$2)); + var $$x6 = this$24.const__O__Z__Ljapgolly_scalajs_react_Reusable(a, false); + var this$26 = $j_scala$002e$0024less$0024colon$0024less$0024.$m_s_$less$colon$less$(); + + var __japgolly__render_deps = $$x6.map__F1__Ljapgolly_scalajs_react_Reusable(this$26.s_$less$colon$less$__f_singleton); + + var __japgolly__render_deps_state = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__render_deps, __japgolly__render_state, $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusableReusability__F2()); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => __japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value.value__O())).rawNode__sjs_js_$bar(); +}, "u+poZOvMfQxaANVa/LUdcuqBd3I="); +$c_Ljapgolly_scalajs_react_test_emissions_RenderReusable$.prototype.japgolly$scalajs$react$test$emissions$RenderReusable$$$anonfun$CtxFn_P$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s3(function (props) { + _s3(); + + var __japgolly__hook1_raw = $i_react.useState(() => { + $m_Ljapgolly_scalajs_react_test_emissions_RenderReusable$(); + return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(20); + }); + + var __japgolly__hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook1_raw); + + var __japgolly__hook2_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$().callback__Ljapgolly_scalajs_react_util_Effect$Dispatch__Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); + + var __japgolly__hook2_jscb = __japgolly__hook2_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_f$1.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline("asd", $j_scala$002eArray$0024.$m_sci_Nil$()))); + + var $$x1 = $i_react; + var a = []; + + var __japgolly__hook2_raw = $$x1.useCallback(__japgolly__hook2_jscb, a); + + var __japgolly__hook2 = __japgolly__hook2_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_g$1.apply__O__O(__japgolly__hook2_raw); + + var __japgolly__hook3_state = $i_react.useState(0); + + var __japgolly__hook3 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().useForceUpdateRaw__sjs_js_Tuple2__Ljapgolly_scalajs_react_Reusable(__japgolly__hook3_state); + + var __japgolly__render_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eNone$0024.$m_s_None$())); + + var __japgolly__render_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw); + + var this$28 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var $$x6 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + var v = "P=" + props.a + ", S=" + __japgolly__hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]; + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + var $$x5 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(v); + var $$x4 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var array = [$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var r = $j_japgolly$002escalajs$002ereact$002eReusability.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(__japgolly__hook1); + return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$3$2 => { + var x$3 = x$3$2 | 0; + return 1 + x$3 | 0; + })).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline); + }), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]; + var $$x3 = $$x4.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("button", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); + var $$x2 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var array$1 = [$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$m_Ljapgolly_scalajs_react_callback_CallbackTo$().$greater$greater$extension__Ljapgolly_scalajs_react_callback_Trampoline__Ljapgolly_scalajs_react_callback_Trampoline__Ljapgolly_scalajs_react_callback_Trampoline(($j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(), __japgolly__hook2.value__O()).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline, ($j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(), __japgolly__hook3.value__O()).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline))), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]; + var array$2 = [$$x5, $$x3, $$x2.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("button", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array$1))]; + var a$1 = $$x6.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("div", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array$2)); + var $$x7 = this$28.const__O__Z__Ljapgolly_scalajs_react_Reusable(a$1, false); + var this$30 = $j_scala$002e$0024less$0024colon$0024less$0024.$m_s_$less$colon$less$(); + + var __japgolly__render_deps = $$x7.map__F1__Ljapgolly_scalajs_react_Reusable(this$30.s_$less$colon$less$__f_singleton); + + var __japgolly__render_deps_state = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__render_deps, __japgolly__render_state, $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusableReusability__F2()); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => __japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value.value__O())).rawNode__sjs_js_$bar(); +}, "7yecI2L01YwM+MN3XxuDliv1kG0=", true); +$c_Ljapgolly_scalajs_react_test_emissions_RenderReusable$.prototype.japgolly$scalajs$react$test$emissions$RenderReusable$$$anonfun$P_PC$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s4(function (props) { + _s4(); + + var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren.$m_Ljapgolly_scalajs_react_PropsChildren$().fromRawProps__sjs_js_Object__sjs_js_Any(props); + + var __japgolly__render_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eNone$0024.$m_s_None$())); + + var __japgolly__render_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw); + + var this$11 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var $$x1 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + var v = "P=" + props.a; + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + var array = [new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(v), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(children))]; + var a = $$x1.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("div", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); + var $$x2 = this$11.const__O__Z__Ljapgolly_scalajs_react_Reusable(a, true); + var this$13 = $j_scala$002e$0024less$0024colon$0024less$0024.$m_s_$less$colon$less$(); + + var __japgolly__render_deps = $$x2.map__F1__Ljapgolly_scalajs_react_Reusable(this$13.s_$less$colon$less$__f_singleton); + + var __japgolly__render_deps_state = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__render_deps, __japgolly__render_state, $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusableReusability__F2()); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => __japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value.value__O())).rawNode__sjs_js_$bar(); +}, "M/diGxSdMncUUNsduOrYE4sj5Xs="); +$c_Ljapgolly_scalajs_react_test_emissions_RenderReusable$.prototype.japgolly$scalajs$react$test$emissions$RenderReusable$$$anonfun$CtxObj_P_PC$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s5(function (props) { + _s5(); + + var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren.$m_Ljapgolly_scalajs_react_PropsChildren$().fromRawProps__sjs_js_Object__sjs_js_Any(props); + + var __japgolly__hook1_raw = $i_react.useRef(null); + + var this$2 = $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook1_raw); + var ct = new $j_scala$002ereflect$002eClassTag$0024GenericClassTag.$c_s_reflect_ClassTag$GenericClassTag($j_org$002escalajs$002edom$002eHTMLInputElement.$d_Lorg_scalajs_dom_HTMLInputElement.getClassOf()); + + var __japgolly__hook1 = $j_japgolly$002escalajs$002ereact$002eRef$0024FullF.$f_Ljapgolly_scalajs_react_Ref$FullF__narrowOption__s_reflect_ClassTag__Ljapgolly_scalajs_react_Ref$FullF(this$2, ct); + + var __japgolly__hook2_raw = $i_react.useState(() => { + $m_Ljapgolly_scalajs_react_test_emissions_RenderReusable$(); + return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box("x"); + }); + + var __japgolly__hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw); + + props.a; + + var __japgolly__render_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eNone$0024.$m_s_None$())); + + var __japgolly__render_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw); + + var this$18 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var $$x2 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var $$x1 = $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$less.input__Ljapgolly_scalajs_react_vdom_HtmlTags$input$().Ljapgolly_scalajs_react_vdom_HtmlTags$input$__f_text.withRef__s_Option__Ljapgolly_scalajs_react_vdom_TagOf(new $j_scala$002eSome.$c_s_Some(__japgolly__hook1)); + var array = [$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_value.$colon$eq__O__F2__Ljapgolly_scalajs_react_vdom_TagMod(__japgolly__hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0], $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_PackageBase__f_vdomAttrVtString), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onChange.$eq$eq$greater__F1__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(e$2 => new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($p_Ljapgolly_scalajs_react_test_emissions_RenderReusable$__onChange$1__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_callback_Trampoline(this, e$2, __japgolly__hook2))), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]; + var array$1 = [$$x1.apply__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(children))]; + var a = $$x2.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("div", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array$1)); + var $$x3 = this$18.const__O__Z__Ljapgolly_scalajs_react_Reusable(a, false); + var this$20 = $j_scala$002e$0024less$0024colon$0024less$0024.$m_s_$less$colon$less$(); + + var __japgolly__render_deps = $$x3.map__F1__Ljapgolly_scalajs_react_Reusable(this$20.s_$less$colon$less$__f_singleton); + + var __japgolly__render_deps_state = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__render_deps, __japgolly__render_state, $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusableReusability__F2()); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => __japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value.value__O())).rawNode__sjs_js_$bar(); +}, "VSjdwEEAcrMZYQ9UbK8I+017TI4="); +$c_Ljapgolly_scalajs_react_test_emissions_RenderReusable$.prototype.japgolly$scalajs$react$test$emissions$RenderReusable$$$anonfun$CtxFn_P_PC$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s6(function (props) { + _s6(); + + var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren.$m_Ljapgolly_scalajs_react_PropsChildren$().fromRawProps__sjs_js_Object__sjs_js_Any(props); + + var __japgolly__hook1_raw = $i_react.useRef(null); + + var this$2 = $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook1_raw); + var ct = new $j_scala$002ereflect$002eClassTag$0024GenericClassTag.$c_s_reflect_ClassTag$GenericClassTag($j_org$002escalajs$002edom$002eHTMLInputElement.$d_Lorg_scalajs_dom_HTMLInputElement.getClassOf()); + + var __japgolly__hook1 = $j_japgolly$002escalajs$002ereact$002eRef$0024FullF.$f_Ljapgolly_scalajs_react_Ref$FullF__narrowOption__s_reflect_ClassTag__Ljapgolly_scalajs_react_Ref$FullF(this$2, ct); + + var __japgolly__hook2_raw = $i_react.useState(() => { + $m_Ljapgolly_scalajs_react_test_emissions_RenderReusable$(); + return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box("x"); + }); + + var __japgolly__hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw); + + var __japgolly__render_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eNone$0024.$m_s_None$())); + + var __japgolly__render_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw); + + var this$17 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var $$x2 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var $$x1 = $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$less.input__Ljapgolly_scalajs_react_vdom_HtmlTags$input$().Ljapgolly_scalajs_react_vdom_HtmlTags$input$__f_text.withRef__s_Option__Ljapgolly_scalajs_react_vdom_TagOf(new $j_scala$002eSome.$c_s_Some(__japgolly__hook1)); + var array = [$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_value.$colon$eq__O__F2__Ljapgolly_scalajs_react_vdom_TagMod(__japgolly__hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0], $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_PackageBase__f_vdomAttrVtString), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onChange.$eq$eq$greater__F1__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(e$2 => new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($p_Ljapgolly_scalajs_react_test_emissions_RenderReusable$__onChange$2__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_callback_Trampoline(this, e$2, __japgolly__hook2))), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]; + var array$1 = [$$x1.apply__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(children))]; + var a = $$x2.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("div", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array$1)); + var $$x3 = this$17.const__O__Z__Ljapgolly_scalajs_react_Reusable(a, false); + var this$19 = $j_scala$002e$0024less$0024colon$0024less$0024.$m_s_$less$colon$less$(); + + var __japgolly__render_deps = $$x3.map__F1__Ljapgolly_scalajs_react_Reusable(this$19.s_$less$colon$less$__f_singleton); + + var __japgolly__render_deps_state = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__render_deps, __japgolly__render_state, $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusableReusability__F2()); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => __japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value.value__O())).rawNode__sjs_js_$bar(); +}, "VSjdwEEAcrMZYQ9UbK8I+017TI4="); +var $d_Ljapgolly_scalajs_react_test_emissions_RenderReusable$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_RenderReusable$: 0 +}, false, "japgolly.scalajs.react.test.emissions.RenderReusable$", { + Ljapgolly_scalajs_react_test_emissions_RenderReusable$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_RenderReusable$ }; +$c_Ljapgolly_scalajs_react_test_emissions_RenderReusable$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_RenderReusable$; +var $n_Ljapgolly_scalajs_react_test_emissions_RenderReusable$; + +function $m_Ljapgolly_scalajs_react_test_emissions_RenderReusable$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_RenderReusable$) { + $n_Ljapgolly_scalajs_react_test_emissions_RenderReusable$ = new $c_Ljapgolly_scalajs_react_test_emissions_RenderReusable$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_RenderReusable$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_RenderReusable$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/RenderReusable-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/RenderReusable-out3.js new file mode 100644 index 000000000..6fa521eed --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/RenderReusable-out3.js @@ -0,0 +1,487 @@ +'use strict'; + +import * as $i_react from "react"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Children from "./japgolly.scalajs.react.CtorType$Children.js"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Nullary from "./japgolly.scalajs.react.CtorType$Nullary.js"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Props from "./japgolly.scalajs.react.CtorType$Props.js"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024PropsAndChildren from "./japgolly.scalajs.react.CtorType$PropsAndChildren.js"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eNonEmptyRef$0024FullF from "./japgolly.scalajs.react.NonEmptyRef$FullF.js"; +import * as $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024package$0024PropsChildren$0024 from "./japgolly.scalajs.react.PropsChildren$package$PropsChildren$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eRef$0024 from "./japgolly.scalajs.react.Ref$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eRef$0024FullF from "./japgolly.scalajs.react.Ref$FullF.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusability from "./japgolly.scalajs.react.Reusability.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusable from "./japgolly.scalajs.react.Reusable.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024 from "./japgolly.scalajs.react.callback.Trampoline$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay from "./japgolly.scalajs.react.callback.Trampoline$Delay.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eGeneric$0024UnmountedRaw from "./japgolly.scalajs.react.component.Generic$UnmountedRaw.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseCallbackArg$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseRefF from "./japgolly.scalajs.react.hooks.Hooks$UseRefF.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024 from "./japgolly.scalajs.react.internal.ShouldComponentUpdateComponent$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 from "./japgolly.scalajs.react.internal.Singleton$.js"; +import * as $j_japgolly$002escalajs$002ereact$002epackage$0024 from "./japgolly.scalajs.react.package$.js"; +import * as $j_japgolly$002escalajs$002ereact$002etest$002eemissions$002ePI from "./japgolly.scalajs.react.test.emissions.PI.js"; +import * as $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024 from "./japgolly.scalajs.react.util.DefaultEffects$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024 from "./japgolly.scalajs.react.util.EffectCallback$callback$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024 from "./japgolly.scalajs.react.vdom.Attr$EventCallback$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite from "./japgolly.scalajs.react.vdom.TagLite.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagMod from "./japgolly.scalajs.react.vdom.TagMod.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagOf$0024RefArg$0024 from "./japgolly.scalajs.react.vdom.TagOf$RefArg$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomElement$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode from "./japgolly.scalajs.react.vdom.VdomNode.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_org$002escalajs$002edom$002eHTMLInputElement from "./org.scalajs.dom.HTMLInputElement.js"; +import * as $j_scala$002e$0024less$0024colon$0024less$0024 from "./scala.$less$colon$less$.js"; +import * as $j_scala$002eArray$0024 from "./scala.Array$.js"; +import * as $j_scala$002eFunction1 from "./scala.Function1.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; +import * as $j_scala$002escalajs$002eruntime$002eCompat$0024 from "./scala.scalajs.runtime.Compat$.js"; + +function $p_Ljapgolly_scalajs_react_test_emissions_RenderReusable$__onChange$1__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_callback_Trampoline($thiz, s$2, e) { + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var r = $j_japgolly$002escalajs$002ereact$002eReusability.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__setState__Ljapgolly_scalajs_react_Reusable(s$2); + var ev$7 = r.value__O().apply__O__O(e.target.value); + return ev$7 === null ? null : ev$7.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline; +} + +export { $p_Ljapgolly_scalajs_react_test_emissions_RenderReusable$__onChange$1__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_callback_Trampoline }; + +function $p_Ljapgolly_scalajs_react_test_emissions_RenderReusable$__onChange$2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_callback_Trampoline($thiz, __japgolly__hook2$2, e) { + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var r = $j_japgolly$002escalajs$002ereact$002eReusability.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__setState__Ljapgolly_scalajs_react_Reusable(__japgolly__hook2$2); + var ev$8 = r.value__O().apply__O__O(e.target.value); + return ev$8 === null ? null : ev$8.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline; +} + +export { $p_Ljapgolly_scalajs_react_test_emissions_RenderReusable$__onChange$2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_callback_Trampoline }; + +function $c_Ljapgolly_scalajs_react_test_emissions_RenderReusable$() { + var _s = $RefreshSig$(), + _s2 = $RefreshSig$(), + _s3 = $RefreshSig$(), + _s4 = $RefreshSig$(), + _s5 = $RefreshSig$(), + _s6 = $RefreshSig$(); + + this.Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_P = null; + this.Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_CtxObj_P = null; + this.Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_CtxFn_P = null; + this.Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_P_PC = null; + this.Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_CtxObj_P_PC = null; + this.Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_CtxFn_P_PC = null; + $n_Ljapgolly_scalajs_react_test_emissions_RenderReusable$ = this; + var s$proxy1 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); + + var rawComponent = props => { + _s(); + + var __japgolly__render_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eArray$0024.$m_s_None$())); + + var __japgolly__render_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw); + + var p = props.a; + var $$x3 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + + var $$x2 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$()._toString__s_Product__T(p); + + var $$x1 = new $j_scala$002eArray$0024.$c_s_reflect_ClassTag$GenericClassTag($j_java$002elang$002eObject.$d_T.getClassOf()); + var this$3 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + + var __japgolly__render_deps = $$x3.implicitly__O__s_reflect_ClassTag__F2__Ljapgolly_scalajs_react_Reusable($$x2, $$x1, this$3.by_$eq$eq__F2()).map__F1__Ljapgolly_scalajs_react_Reusable(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(v => { + var v$1 = v; + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + return new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(v$1); + })); + + var __japgolly__render_deps_state = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__render_deps, __japgolly__render_state, $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusableReusability__F2()); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => __japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value.value__O())).rawNode__O(); + }; + + _s(rawComponent, "LqO7qddGnL/1O/Kyd3Xtp6x9iJE="); + + var $$x4 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$6 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + this.Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_P = $$x4.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$6.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s$proxy1)); + var s$proxy2 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonN__Ljapgolly_scalajs_react_internal_Singleton__Ljapgolly_scalajs_react_CtorType$Summoner($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$().Ljapgolly_scalajs_react_internal_Singleton$__f_BoxUnit); + + var rawComponent$2 = props$2 => { + _s2(); + + var __japgolly__hook1_raw = $i_react.useRef(100); + + var this$8 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); + + var __japgolly__hook1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseRefF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseRefF(__japgolly__hook1_raw, this$8.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + + var __japgolly__hook2_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(0)); + + var __japgolly__hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw); + + props$2.a; + + var __japgolly__render_state_raw$1 = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eArray$0024.$m_s_None$())); + + var __japgolly__render_state$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw$1); + + var this$22 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var this$21 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self$2 = "div"; + var $$x7 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + var v$2 = __japgolly__hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseRefF__f_raw.current | 0; + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + var $$x6 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(v$2); + var this$16 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self = "button"; + var xs = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + var f = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$1 => { + var _$1$1 = _$1 | 0; + + return 1 + _$1$1 | 0; + }); + var ev$2 = $j_japgolly$002escalajs$002ereact$002eNonEmptyRef$0024FullF.$f_Ljapgolly_scalajs_react_NonEmptyRef$FullF__mod__F1__O(__japgolly__hook1, f); + return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(ev$2 === null ? null : ev$2.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline); + }), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)])); + var $$x5 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$16, self, xs); + var this$20 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self$1 = "button"; + var xs$1 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var r = $j_japgolly$002escalajs$002ereact$002eReusability.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(__japgolly__hook2); + var ev$3 = r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$2 => { + var _$2$1 = _$2 | 0; + + return 1 + _$2$1 | 0; + })); + return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(ev$3 === null ? null : ev$3.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline); + }), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)])); + var xs$2 = $$x7.wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([$$x6, $$x5, $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$20, self$1, xs$1)])); + var a = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$21, self$2, xs$2); + var $$x8 = this$22.const__O__Z__Ljapgolly_scalajs_react_Reusable(a, false); + var this$24 = $j_scala$002e$0024less$0024colon$0024less$0024.$m_s_$less$colon$less$(); + + var __japgolly__render_deps$1 = $$x8.map__F1__Ljapgolly_scalajs_react_Reusable(this$24.s_$less$colon$less$__f_singleton); + + var __japgolly__render_deps_state$1 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__render_deps$1, __japgolly__render_state$1, $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusableReusability__F2()); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state$1.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => __japgolly__render_deps_state$1.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value.value__O())).rawNode__O(); + }; + + _s2(rawComponent$2, "N81TqRKjoN5vKcxkXvqCldke0YU="); + + var $$x9 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$25 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + this.Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_CtxObj_P = $$x9.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$25.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent$2, s$proxy2)); + + var rawComponent$3 = props$3 => { + _s3(); + + var __japgolly__hook1_raw$1 = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(20)); + + var __japgolly__hook1$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook1_raw$1); + + var __japgolly__hook2_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$().callback__Ljapgolly_scalajs_react_util_Effect$Dispatch__Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); + + var $$x10 = __japgolly__hook2_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_f$1; + var optionalParams$proxy1 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); + var f$proxy7 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + console.log("asd", ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy1)); + }); + + var __japgolly__hook2_jscb = $$x10.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy7)))); + + var __japgolly__hook2_raw$1 = $i_react.useCallback(__japgolly__hook2_jscb, []); + + var __japgolly__hook2$1 = __japgolly__hook2_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_g$1.apply__O__O(__japgolly__hook2_raw$1); + + var __japgolly__hook3_state = $i_react.useState(0); + + var __japgolly__hook3 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().useForceUpdateRaw__sjs_js_Tuple2__Ljapgolly_scalajs_react_Reusable(__japgolly__hook3_state); + + var __japgolly__render_state_raw$2 = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eArray$0024.$m_s_None$())); + + var __japgolly__render_state$2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw$2); + + var p$1 = props$3.a; + var this$43 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var this$42 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self$5 = "div"; + var $$x14 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + var v$3 = "P=" + p$1 + ", S=" + __japgolly__hook1$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + var $$x13 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(v$3); + var this$36 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self$3 = "button"; + var xs$3 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var r$1 = $j_japgolly$002escalajs$002ereact$002eReusability.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(__japgolly__hook1$1); + var ev$4 = r$1.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$3 => { + var _$3$1 = _$3 | 0; + + return 1 + _$3$1 | 0; + })); + return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(ev$4 === null ? null : ev$4.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline); + }), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)])); + var $$x12 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$36, self$3, xs$3); + var this$41 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self$4 = "button"; + var xs$4 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + + var ev$5 = __japgolly__hook2$1.value__O(); + + var ev$1 = ev$5 === null ? null : ev$5.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline; + var $$x11 = $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$m_Ljapgolly_scalajs_react_callback_CallbackTo$(); + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + + var ev$6 = __japgolly__hook3.value__O(); + + return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($$x11.$greater$greater$extension__Ljapgolly_scalajs_react_callback_Trampoline__Ljapgolly_scalajs_react_callback_Trampoline__Ljapgolly_scalajs_react_callback_Trampoline(ev$1, ev$6 === null ? null : ev$6.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline)); + }), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)])); + var xs$5 = $$x14.wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([$$x13, $$x12, $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$41, self$4, xs$4)])); + var a$1 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$42, self$5, xs$5); + var $$x15 = this$43.const__O__Z__Ljapgolly_scalajs_react_Reusable(a$1, false); + var this$45 = $j_scala$002e$0024less$0024colon$0024less$0024.$m_s_$less$colon$less$(); + + var __japgolly__render_deps$2 = $$x15.map__F1__Ljapgolly_scalajs_react_Reusable(this$45.s_$less$colon$less$__f_singleton); + + var __japgolly__render_deps_state$2 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__render_deps$2, __japgolly__render_state$2, $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusableReusability__F2()); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state$2.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => __japgolly__render_deps_state$2.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value.value__O())).rawNode__O(); + }; + + _s3(rawComponent$3, "FfFcmS/xahfGPO7v/c1S2fZHBQE=", true); + + var $$x16 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$46 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); + this.Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_CtxFn_P = $$x16.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$46.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent$3, s)); + + var rawComponent$4 = props$4 => { + _s4(); + + var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024package$0024PropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$package$PropsChildren$().fromRawProps__sjs_js_Object__O(props$4); + + var __japgolly__render_state_raw$3 = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eArray$0024.$m_s_None$())); + + var __japgolly__render_state$3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw$3); + + var p$2 = props$4.a; + var this$55 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var this$54 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self$6 = "div"; + var $$x17 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + var v$4 = "P=" + p$2; + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + var xs$6 = $$x17.wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(v$4), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(children))])); + var a$2 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$54, self$6, xs$6); + var $$x18 = this$55.const__O__Z__Ljapgolly_scalajs_react_Reusable(a$2, true); + var this$57 = $j_scala$002e$0024less$0024colon$0024less$0024.$m_s_$less$colon$less$(); + + var __japgolly__render_deps$3 = $$x18.map__F1__Ljapgolly_scalajs_react_Reusable(this$57.s_$less$colon$less$__f_singleton); + + var __japgolly__render_deps_state$3 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__render_deps$3, __japgolly__render_state$3, $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusableReusability__F2()); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state$3.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => __japgolly__render_deps_state$3.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value.value__O())).rawNode__O(); + }; + + _s4(rawComponent$4, "L1iPDI2WUeUZjh7Tn4FDlDqxBDc="); + + var $$x19 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$58 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s$1 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonPC__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); + this.Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_P_PC = $$x19.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$58.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent$4, s$1)); + var s$proxy7 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonC__Ljapgolly_scalajs_react_internal_Singleton__Ljapgolly_scalajs_react_CtorType$Summoner($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$().Ljapgolly_scalajs_react_internal_Singleton$__f_BoxUnit); + + var rawComponent$5 = props$5 => { + _s5(); + + var children$1 = $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024package$0024PropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$package$PropsChildren$().fromRawProps__sjs_js_Object__O(props$5); + + var __japgolly__hook1_raw$2 = $i_react.useRef(null); + + var this$60 = $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook1_raw$2); + var ct = new $j_scala$002eArray$0024.$c_s_reflect_ClassTag$GenericClassTag($j_org$002escalajs$002edom$002eHTMLInputElement.$d_Lorg_scalajs_dom_HTMLInputElement.getClassOf()); + + var __japgolly__hook1$2 = $j_japgolly$002escalajs$002ereact$002eRef$0024FullF.$f_Ljapgolly_scalajs_react_Ref$FullF__narrowOption__s_reflect_ClassTag__Ljapgolly_scalajs_react_Ref$FullF(this$60, ct); + + var __japgolly__hook2_raw$2 = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box("x")); + + var __japgolly__hook2$2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw$2); + + props$5.a; + + var __japgolly__render_state_raw$4 = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eArray$0024.$m_s_None$())); + + var __japgolly__render_state$4 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw$4); + + var this$68 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var this$67 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self$7 = "div"; + var xs$7 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$less.input__Ljapgolly_scalajs_react_vdom_HtmlTags$input$().Ljapgolly_scalajs_react_vdom_HtmlTags$input$__f_text.withRef__s_Option__Ljapgolly_scalajs_react_vdom_TagOf($j_japgolly$002escalajs$002ereact$002evdom$002eTagOf$0024RefArg$0024.$m_Ljapgolly_scalajs_react_vdom_TagOf$RefArg$().set__Ljapgolly_scalajs_react_Ref$SetF__s_Option(__japgolly__hook1$2)).apply__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf($j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_value.$colon$eq__O__F2__Ljapgolly_scalajs_react_vdom_TagMod(__japgolly__hook2$2.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0], $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_PackageBase__f_vdomAttrVtString), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onChange.$eq$eq$greater__F1__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(e => new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($p_Ljapgolly_scalajs_react_test_emissions_RenderReusable$__onChange$1__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_callback_Trampoline(this, __japgolly__hook2$2, e))), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]))), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(children$1))])); + var a$3 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$67, self$7, xs$7); + var $$x20 = this$68.const__O__Z__Ljapgolly_scalajs_react_Reusable(a$3, false); + var this$70 = $j_scala$002e$0024less$0024colon$0024less$0024.$m_s_$less$colon$less$(); + + var __japgolly__render_deps$4 = $$x20.map__F1__Ljapgolly_scalajs_react_Reusable(this$70.s_$less$colon$less$__f_singleton); + + var __japgolly__render_deps_state$4 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__render_deps$4, __japgolly__render_state$4, $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusableReusability__F2()); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state$4.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => __japgolly__render_deps_state$4.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value.value__O())).rawNode__O(); + }; + + _s5(rawComponent$5, "Nb2f/gvbdXTWnKivh/RajIDKBbc="); + + var $$x21 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$71 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + this.Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_CtxObj_P_PC = $$x21.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$71.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent$5, s$proxy7)); + + var rawComponent$6 = props$6$1 => { + _s6(); + + var children$2 = $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024package$0024PropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$package$PropsChildren$().fromRawProps__sjs_js_Object__O(props$6$1); + + var __japgolly__hook1_raw$3 = $i_react.useRef(null); + + var this$73 = $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook1_raw$3); + var ct$1 = new $j_scala$002eArray$0024.$c_s_reflect_ClassTag$GenericClassTag($j_org$002escalajs$002edom$002eHTMLInputElement.$d_Lorg_scalajs_dom_HTMLInputElement.getClassOf()); + + var __japgolly__hook1$3 = $j_japgolly$002escalajs$002ereact$002eRef$0024FullF.$f_Ljapgolly_scalajs_react_Ref$FullF__narrowOption__s_reflect_ClassTag__Ljapgolly_scalajs_react_Ref$FullF(this$73, ct$1); + + var __japgolly__hook2_raw$3 = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box("x")); + + var __japgolly__hook2$3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw$3); + + var __japgolly__render_state_raw$5 = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eArray$0024.$m_s_None$())); + + var __japgolly__render_state$5 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw$5); + + props$6$1.a; + var this$80 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var this$79 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self$8 = "div"; + var xs$8 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$less.input__Ljapgolly_scalajs_react_vdom_HtmlTags$input$().Ljapgolly_scalajs_react_vdom_HtmlTags$input$__f_text.withRef__s_Option__Ljapgolly_scalajs_react_vdom_TagOf($j_japgolly$002escalajs$002ereact$002evdom$002eTagOf$0024RefArg$0024.$m_Ljapgolly_scalajs_react_vdom_TagOf$RefArg$().set__Ljapgolly_scalajs_react_Ref$SetF__s_Option(__japgolly__hook1$3)).apply__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf($j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_value.$colon$eq__O__F2__Ljapgolly_scalajs_react_vdom_TagMod(__japgolly__hook2$3.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0], $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_PackageBase__f_vdomAttrVtString), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onChange.$eq$eq$greater__F1__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(e$1 => new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($p_Ljapgolly_scalajs_react_test_emissions_RenderReusable$__onChange$2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_callback_Trampoline(this, __japgolly__hook2$3, e$1))), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]))), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(children$2))])); + var a$4 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$79, self$8, xs$8); + var $$x22 = this$80.const__O__Z__Ljapgolly_scalajs_react_Reusable(a$4, false); + var this$82 = $j_scala$002e$0024less$0024colon$0024less$0024.$m_s_$less$colon$less$(); + + var __japgolly__render_deps$5 = $$x22.map__F1__Ljapgolly_scalajs_react_Reusable(this$82.s_$less$colon$less$__f_singleton); + + var __japgolly__render_deps_state$5 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__render_deps$5, __japgolly__render_state$5, $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusableReusability__F2()); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state$5.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => __japgolly__render_deps_state$5.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value.value__O())).rawNode__O(); + }; + + _s6(rawComponent$6, "Q2EthKS++vBhx2pAlqNww9Pvaec="); + + var $$x23 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$83 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s$2 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonC__Ljapgolly_scalajs_react_internal_Singleton__Ljapgolly_scalajs_react_CtorType$Summoner($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$().Ljapgolly_scalajs_react_internal_Singleton$__f_BoxUnit); + this.Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_CtxFn_P_PC = $$x23.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$83.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent$6, s$2)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_RenderReusable$ }; +$c_Ljapgolly_scalajs_react_test_emissions_RenderReusable$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_RenderReusable$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_RenderReusable$; + +function $h_Ljapgolly_scalajs_react_test_emissions_RenderReusable$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_RenderReusable$ }; +$h_Ljapgolly_scalajs_react_test_emissions_RenderReusable$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_RenderReusable$.prototype; + +$c_Ljapgolly_scalajs_react_test_emissions_RenderReusable$.prototype.all__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot = function () { + return $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_ScalaFnComponent.apply__F1__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(p => { + var p$1 = p; + var this$33 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self = "div"; + var $$x6 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$(); + var c = this.Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_P; + var this$5 = c.ctor__Ljapgolly_scalajs_react_CtorType(); + var u = this$5.Ljapgolly_scalajs_react_CtorType$Props__f_construct.apply__O__O__O(p$1, this$5.Ljapgolly_scalajs_react_CtorType$Props__f_mods); + var n = u.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var $$x5 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n); + var c$1 = this.Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_CtxObj_P; + var u$1 = c$1.ctor__Ljapgolly_scalajs_react_CtorType().apply__O(); + var n$1 = u$1.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var $$x4 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n$1); + var c$2 = this.Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_CtxFn_P; + var this$12 = c$2.ctor__Ljapgolly_scalajs_react_CtorType(); + var u$2 = this$12.Ljapgolly_scalajs_react_CtorType$Props__f_construct.apply__O__O__O(p$1, this$12.Ljapgolly_scalajs_react_CtorType$Props__f_mods); + var n$2 = u$2.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var $$x3 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n$2); + var c$3 = this.Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_P_PC; + var this$18 = c$3.ctor__Ljapgolly_scalajs_react_CtorType(); + var children = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode.$d_Ljapgolly_scalajs_react_vdom_VdomNode.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(1))])); + var u$3 = this$18.Ljapgolly_scalajs_react_CtorType$PropsAndChildren__f_construct.apply__O__O__O__O(p$1, this$18.Ljapgolly_scalajs_react_CtorType$PropsAndChildren__f_mods, children); + var n$3 = u$3.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var $$x2 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n$3); + var c$4 = this.Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_CtxObj_P_PC; + var this$24 = c$4.ctor__Ljapgolly_scalajs_react_CtorType(); + var children$1 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode.$d_Ljapgolly_scalajs_react_vdom_VdomNode.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(2))])); + var u$4 = this$24.Ljapgolly_scalajs_react_CtorType$Children__f_construct.apply__O__O__O(this$24.Ljapgolly_scalajs_react_CtorType$Children__f_mods, children$1); + var n$4 = u$4.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var $$x1 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n$4); + var c$5 = this.Ljapgolly_scalajs_react_test_emissions_RenderReusable$__f_CtxFn_P_PC; + var this$30 = c$5.ctor__Ljapgolly_scalajs_react_CtorType(); + var children$2 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode.$d_Ljapgolly_scalajs_react_vdom_VdomNode.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(3))])); + var u$5 = this$30.Ljapgolly_scalajs_react_CtorType$Children__f_construct.apply__O__O__O(this$30.Ljapgolly_scalajs_react_CtorType$Children__f_mods, children$2); + var n$5 = u$5.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var xs = $$x6.wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([$$x5, $$x4, $$x3, $$x2, $$x1, new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n$5)])); + return $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$33, self, xs); + }), $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null)); +}; + +var $d_Ljapgolly_scalajs_react_test_emissions_RenderReusable$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_RenderReusable$: 0 +}, false, "japgolly.scalajs.react.test.emissions.RenderReusable$", { + Ljapgolly_scalajs_react_test_emissions_RenderReusable$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_RenderReusable$ }; +$c_Ljapgolly_scalajs_react_test_emissions_RenderReusable$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_RenderReusable$; +var $n_Ljapgolly_scalajs_react_test_emissions_RenderReusable$; + +function $m_Ljapgolly_scalajs_react_test_emissions_RenderReusable$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_RenderReusable$) { + $n_Ljapgolly_scalajs_react_test_emissions_RenderReusable$ = new $c_Ljapgolly_scalajs_react_test_emissions_RenderReusable$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_RenderReusable$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_RenderReusable$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/RenderWithReuse-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/RenderWithReuse-out2.js new file mode 100644 index 000000000..06dee4e31 --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/RenderWithReuse-out2.js @@ -0,0 +1,482 @@ +'use strict'; + +var _s = $RefreshSig$(), + _s2 = $RefreshSig$(), + _s3 = $RefreshSig$(), + _s4 = $RefreshSig$(), + _s5 = $RefreshSig$(), + _s6 = $RefreshSig$(); + +import * as $i_react from "react"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Children from "./japgolly.scalajs.react.CtorType$Children.js"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Nullary from "./japgolly.scalajs.react.CtorType$Nullary.js"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Props from "./japgolly.scalajs.react.CtorType$Props.js"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024PropsAndChildren from "./japgolly.scalajs.react.CtorType$PropsAndChildren.js"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eNonEmptyRef$0024FullF from "./japgolly.scalajs.react.NonEmptyRef$FullF.js"; +import * as $j_japgolly$002escalajs$002ereact$002ePropsChildren from "./japgolly.scalajs.react.PropsChildren.js"; +import * as $j_japgolly$002escalajs$002ereact$002eRef$0024 from "./japgolly.scalajs.react.Ref$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eRef$0024FullF from "./japgolly.scalajs.react.Ref$FullF.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusability from "./japgolly.scalajs.react.Reusability.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusable from "./japgolly.scalajs.react.Reusable.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eGeneric$0024UnmountedRaw from "./japgolly.scalajs.react.component.Generic$UnmountedRaw.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024 from "./japgolly.scalajs.react.hooks.HookCtx$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P1 from "./japgolly.scalajs.react.hooks.HookCtx$P1.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2 from "./japgolly.scalajs.react.hooks.HookCtx$P2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P3 from "./japgolly.scalajs.react.hooks.HookCtx$P3.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024PC0 from "./japgolly.scalajs.react.hooks.HookCtx$PC0.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024PC1 from "./japgolly.scalajs.react.hooks.HookCtx$PC1.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024PC2 from "./japgolly.scalajs.react.hooks.HookCtx$PC2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseCallbackArg$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseRefF from "./japgolly.scalajs.react.hooks.Hooks$UseRefF.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseStateF$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024 from "./japgolly.scalajs.react.internal.ShouldComponentUpdateComponent$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 from "./japgolly.scalajs.react.internal.Singleton$.js"; +import * as $j_japgolly$002escalajs$002ereact$002epackage$0024 from "./japgolly.scalajs.react.package$.js"; +import * as $j_japgolly$002escalajs$002ereact$002etest$002eemissions$002ePI from "./japgolly.scalajs.react.test.emissions.PI.js"; +import * as $j_japgolly$002escalajs$002ereact$002etest$002eemissions$002ePI$0024 from "./japgolly.scalajs.react.test.emissions.PI$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024 from "./japgolly.scalajs.react.util.DefaultEffects$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024 from "./japgolly.scalajs.react.util.EffectCallback$callback$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024 from "./japgolly.scalajs.react.vdom.Attr$EventCallback$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomElement$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_org$002escalajs$002edom$002eHTMLInputElement from "./org.scalajs.dom.HTMLInputElement.js"; +import * as $j_scala$002eArray$0024 from "./scala.Array$.js"; +import * as $j_scala$002eFunction1 from "./scala.Function1.js"; +import * as $j_scala$002eNone$0024 from "./scala.None$.js"; +import * as $j_scala$002eSome from "./scala.Some.js"; +import * as $j_scala$002ereflect$002eClassTag$0024GenericClassTag from "./scala.reflect.ClassTag$GenericClassTag.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; +import * as $j_scala$002escalajs$002eruntime$002eWrappedVarArgs from "./scala.scalajs.runtime.WrappedVarArgs.js"; + +function $p_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__onChange$1__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_callback_Trampoline($thiz, e, s$2) { + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var r = $j_japgolly$002escalajs$002ereact$002eReusability.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__setState__Ljapgolly_scalajs_react_Reusable(s$2); + return r.value__O().apply__O__O(e.target.value).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline; +} + +export { $p_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__onChange$1__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_callback_Trampoline }; + +function $p_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__onChange$2__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_callback_Trampoline($thiz, e, __japgolly__hook2$2) { + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var r = $j_japgolly$002escalajs$002ereact$002eReusability.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__setState__Ljapgolly_scalajs_react_Reusable(__japgolly__hook2$2); + return r.value__O().apply__O__O(e.target.value).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline; +} + +export { $p_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__onChange$2__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_callback_Trampoline }; + +function $c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$() { + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_P = null; + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_CtxObj_P = null; + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_CtxFn_P = null; + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_P_PC = null; + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_CtxObj_P_PC = null; + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_CtxFn_P_PC = null; + $n_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$ = this; + + var rawComponent = arg1$2 => $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$().japgolly$scalajs$react$test$emissions$RenderWithReuse$$$anonfun$P$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2); + + var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$(), null)); + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_P = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$1.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); + + var rawComponent$2 = arg1$2$1 => $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$().japgolly$scalajs$react$test$emissions$RenderWithReuse$$$anonfun$CtxObj_P$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2$1); + + var $$x2 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$2 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s$1 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonN__Ljapgolly_scalajs_react_internal_Singleton__Ljapgolly_scalajs_react_CtorType$Summoner($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$().Ljapgolly_scalajs_react_internal_Singleton$__f_BoxUnit); + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_CtxObj_P = $$x2.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$2.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent$2, s$1)); + + var rawComponent$3 = arg1$2$2 => $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$().japgolly$scalajs$react$test$emissions$RenderWithReuse$$$anonfun$CtxFn_P$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2$2); + + var $$x3 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$3 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s$2 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$(), null)); + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_CtxFn_P = $$x3.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$3.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent$3, s$2)); + + var rawComponent$4 = arg1$2$3 => $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$().japgolly$scalajs$react$test$emissions$RenderWithReuse$$$anonfun$P_PC$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2$3); + + var $$x4 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$4 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s$3 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonPC__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$(), null)); + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_P_PC = $$x4.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$4.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent$4, s$3)); + + var rawComponent$5 = arg1$2$4 => $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$().japgolly$scalajs$react$test$emissions$RenderWithReuse$$$anonfun$CtxObj_P_PC$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2$4); + + var $$x5 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$5 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s$4 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonC__Ljapgolly_scalajs_react_internal_Singleton__Ljapgolly_scalajs_react_CtorType$Summoner($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$().Ljapgolly_scalajs_react_internal_Singleton$__f_BoxUnit); + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_CtxObj_P_PC = $$x5.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$5.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent$5, s$4)); + + var rawComponent$6 = arg1$2$5 => $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$().japgolly$scalajs$react$test$emissions$RenderWithReuse$$$anonfun$CtxFn_P_PC$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2$5); + + var $$x6 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$6 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s$5 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonC__Ljapgolly_scalajs_react_internal_Singleton__Ljapgolly_scalajs_react_CtorType$Summoner($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$().Ljapgolly_scalajs_react_internal_Singleton$__f_BoxUnit); + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_CtxFn_P_PC = $$x6.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$6.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent$6, s$5)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$ }; +$c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$; + +function $h_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$ }; +$h_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$.prototype; + +$c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$.prototype.all__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot = function () { + return $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_ScalaFnComponent.apply__F1__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(p$2 => { + var p = p$2; + var $$x6 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var c = $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$().Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_P; + var this$5 = c.ctor__Ljapgolly_scalajs_react_CtorType(); + var u = this$5.Ljapgolly_scalajs_react_CtorType$Props__f_construct.apply__O__O__O(p, this$5.Ljapgolly_scalajs_react_CtorType$Props__f_mods); + var n = u.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var $$x5 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n); + var c$1 = $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$().Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_CtxObj_P; + var u$1 = c$1.ctor__Ljapgolly_scalajs_react_CtorType().apply__O(); + var n$1 = u$1.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var $$x4 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n$1); + var c$2 = $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$().Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_CtxFn_P; + var this$12 = c$2.ctor__Ljapgolly_scalajs_react_CtorType(); + var u$2 = this$12.Ljapgolly_scalajs_react_CtorType$Props__f_construct.apply__O__O__O(p, this$12.Ljapgolly_scalajs_react_CtorType$Props__f_mods); + var n$2 = u$2.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var $$x3 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n$2); + var c$3 = $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$().Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_P_PC; + var this$21 = c$3.ctor__Ljapgolly_scalajs_react_CtorType(); + var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(1))]; + var children = new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array); + var u$3 = this$21.Ljapgolly_scalajs_react_CtorType$PropsAndChildren__f_construct.apply__O__O__O__O(p, this$21.Ljapgolly_scalajs_react_CtorType$PropsAndChildren__f_mods, children); + var n$3 = u$3.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var $$x2 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n$3); + var c$4 = $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$().Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_CtxObj_P_PC; + var this$30 = c$4.ctor__Ljapgolly_scalajs_react_CtorType(); + var array$1 = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(2))]; + var children$1 = new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array$1); + var u$4 = this$30.Ljapgolly_scalajs_react_CtorType$Children__f_construct.apply__O__O__O(this$30.Ljapgolly_scalajs_react_CtorType$Children__f_mods, children$1); + var n$4 = u$4.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var $$x1 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n$4); + var c$5 = $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$().Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_CtxFn_P_PC; + var this$39 = c$5.ctor__Ljapgolly_scalajs_react_CtorType(); + var array$2 = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(3))]; + var children$2 = new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array$2); + var u$5 = this$39.Ljapgolly_scalajs_react_CtorType$Children__f_construct.apply__O__O__O(this$39.Ljapgolly_scalajs_react_CtorType$Children__f_mods, children$2); + var n$5 = u$5.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var array$3 = [$$x5, $$x4, $$x3, $$x2, $$x1, new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n$5)]; + return $$x6.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("div", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array$3)); + }), $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$(), null))); +}; + +$c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$.prototype.japgolly$scalajs$react$test$emissions$RenderWithReuse$$$anonfun$P$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s(function (props) { + _s(); + + var __japgolly__render_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eNone$0024.$m_s_None$())); + + var __japgolly__render_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw); + + var __japgolly__render_deps_state = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(props.a, __japgolly__render_state, $j_japgolly$002escalajs$002ereact$002etest$002eemissions$002ePI$0024.$m_Ljapgolly_scalajs_react_test_emissions_PI$().Ljapgolly_scalajs_react_test_emissions_PI$__f_reusability); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + var v = $j_java$002elang$002eObject.$dp_toString__T(props.a); + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + return new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(v); + })).rawNode__sjs_js_$bar(); +}, "M/diGxSdMncUUNsduOrYE4sj5Xs="); +$c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$.prototype.japgolly$scalajs$react$test$emissions$RenderWithReuse$$$anonfun$CtxObj_P$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s2(function (props) { + _s2(); + + var __japgolly__hook1_raw = $i_react.useRef(100); + + var this$2 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); + + var __japgolly__hook1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseRefF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseRefF(__japgolly__hook1_raw, this$2.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + + var __japgolly__hook2_raw = $i_react.useState(() => { + $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$(); + return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(0); + }); + + var __japgolly__hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw); + + var props$1 = props.a; + + var __japgolly__render_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, __japgolly__hook1, __japgolly__hook2); + + var __japgolly__render_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eNone$0024.$m_s_None$())); + + var __japgolly__render_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw); + + var $$x5 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); + var $$x4 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024.$m_Ljapgolly_scalajs_react_hooks_HookCtx$(); + var this$5 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var $$x3 = this$5.always__F2(); + var $$x2 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$().hooksUseRefF__F2(); + var $$x1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$(); + var this$6 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + + var __japgolly__render_deps_state = $$x5.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__render_ctx, __japgolly__render_state, $$x4.reusabilityP2__F2__F2__F2__F2($$x3, $$x2, $$x1.reusability__F2__F2(this$6.by_$eq$eq__F2()))); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + var ref = __japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; + var s = __japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; + var $$x10 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + var v = ref.Ljapgolly_scalajs_react_hooks_Hooks$UseRefF__f_raw.current | 0; + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + var $$x9 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(v); + var $$x8 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var array = [$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + var f = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$2$2 => { + var x$2 = x$2$2 | 0; + return 1 + x$2 | 0; + }); + return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002eNonEmptyRef$0024FullF.$f_Ljapgolly_scalajs_react_NonEmptyRef$FullF__mod__F1__O(ref, f).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline); + }), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]; + var $$x7 = $$x8.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("button", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); + var $$x6 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var array$1 = [$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var r = $j_japgolly$002escalajs$002ereact$002eReusability.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(s); + return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$3$2 => { + var x$3 = x$3$2 | 0; + return 1 + x$3 | 0; + })).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline); + }), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]; + var array$2 = [$$x9, $$x7, $$x6.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("button", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array$1))]; + return $$x10.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("div", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array$2)); + })).rawNode__sjs_js_$bar(); +}, "friQwdICkQg3H/72a+tCGZH/4cE="); +$c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$.prototype.japgolly$scalajs$react$test$emissions$RenderWithReuse$$$anonfun$CtxFn_P$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s3(function (props) { + _s3(); + + var __japgolly__hook1_raw = $i_react.useState(() => { + $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$(); + return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(20); + }); + + var __japgolly__hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook1_raw); + + var __japgolly__hook2_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$().callback__Ljapgolly_scalajs_react_util_Effect$Dispatch__Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); + + var __japgolly__hook2_jscb = __japgolly__hook2_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_f$1.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline("asd", $j_scala$002eArray$0024.$m_sci_Nil$()))); + + var $$x1 = $i_react; + var a = []; + + var __japgolly__hook2_raw = $$x1.useCallback(__japgolly__hook2_jscb, a); + + var __japgolly__hook2 = __japgolly__hook2_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_g$1.apply__O__O(__japgolly__hook2_raw); + + var __japgolly__hook3_state = $i_react.useState(0); + + var __japgolly__hook3 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().useForceUpdateRaw__sjs_js_Tuple2__Ljapgolly_scalajs_react_Reusable(__japgolly__hook3_state); + + var props$1 = props.a; + + var __japgolly__render_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P3.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P3__O__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P3.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P3(), props$1, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3); + + var __japgolly__render_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eNone$0024.$m_s_None$())); + + var __japgolly__render_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw); + + var $$x5 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); + var $$x4 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024.$m_Ljapgolly_scalajs_react_hooks_HookCtx$(); + var $$x3 = $j_japgolly$002escalajs$002ereact$002etest$002eemissions$002ePI$0024.$m_Ljapgolly_scalajs_react_test_emissions_PI$().Ljapgolly_scalajs_react_test_emissions_PI$__f_reusability; + var $$x2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$(); + var this$8 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + + var __japgolly__render_deps_state = $$x5.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__render_ctx, __japgolly__render_state, $$x4.reusabilityP3__F2__F2__F2__F2__F2($$x3, $$x2.reusability__F2__F2(this$8.by_$eq$eq__F2()), $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusableReusability__F2(), $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusableReusability__F2())); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + var $$x10 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + var v = "P=" + props.a + ", S=" + __japgolly__hook1.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]; + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + var $$x9 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(v); + var $$x8 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var array = [$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var r = $j_japgolly$002escalajs$002ereact$002eReusability.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(__japgolly__hook1); + return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$4$2 => { + var x$4 = x$4$2 | 0; + return 1 + x$4 | 0; + })).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline); + }), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]; + var $$x7 = $$x8.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("button", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); + var $$x6 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var array$1 = [$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$m_Ljapgolly_scalajs_react_callback_CallbackTo$().$greater$greater$extension__Ljapgolly_scalajs_react_callback_Trampoline__Ljapgolly_scalajs_react_callback_Trampoline__Ljapgolly_scalajs_react_callback_Trampoline(($j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(), __japgolly__hook2.value__O()).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline, ($j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(), __japgolly__hook3.value__O()).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline))), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]; + var array$2 = [$$x9, $$x7, $$x6.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("button", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array$1))]; + return $$x10.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("div", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array$2)); + })).rawNode__sjs_js_$bar(); +}, "dBXhXgCZtz5vMCd4F2Oj0k+bIZo=", true); +$c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$.prototype.japgolly$scalajs$react$test$emissions$RenderWithReuse$$$anonfun$P_PC$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s4(function (props) { + _s4(); + + var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren.$m_Ljapgolly_scalajs_react_PropsChildren$().fromRawProps__sjs_js_Object__sjs_js_Any(props); + var props$1 = props.a; + + var __japgolly__render_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024PC0.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$PC0__O__sjs_js_Any__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024PC0.$c_Ljapgolly_scalajs_react_hooks_HookCtx$PC0(), props$1, children); + + var __japgolly__render_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eNone$0024.$m_s_None$())); + + var __japgolly__render_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw); + + var __japgolly__render_deps_state = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__render_ctx, __japgolly__render_state, $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024.$m_Ljapgolly_scalajs_react_hooks_HookCtx$().reusabilityPC0__F2__F2__F2($j_japgolly$002escalajs$002ereact$002etest$002eemissions$002ePI$0024.$m_Ljapgolly_scalajs_react_test_emissions_PI$().Ljapgolly_scalajs_react_test_emissions_PI$__f_reusability, $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$().propsChildren__F2())); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + var $$x1 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + var v = "P=" + props.a; + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + var array = [new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(v), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(children))]; + return $$x1.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("div", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); + })).rawNode__sjs_js_$bar(); +}, "M/diGxSdMncUUNsduOrYE4sj5Xs="); +$c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$.prototype.japgolly$scalajs$react$test$emissions$RenderWithReuse$$$anonfun$CtxObj_P_PC$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s5(function (props) { + _s5(); + + var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren.$m_Ljapgolly_scalajs_react_PropsChildren$().fromRawProps__sjs_js_Object__sjs_js_Any(props); + + var __japgolly__hook1_raw = $i_react.useRef(null); + + var this$2 = $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook1_raw); + var ct = new $j_scala$002ereflect$002eClassTag$0024GenericClassTag.$c_s_reflect_ClassTag$GenericClassTag($j_org$002escalajs$002edom$002eHTMLInputElement.$d_Lorg_scalajs_dom_HTMLInputElement.getClassOf()); + + var __japgolly__hook1 = $j_japgolly$002escalajs$002ereact$002eRef$0024FullF.$f_Ljapgolly_scalajs_react_Ref$FullF__narrowOption__s_reflect_ClassTag__Ljapgolly_scalajs_react_Ref$FullF(this$2, ct); + + var __japgolly__hook2_raw = $i_react.useState(() => { + $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$(); + return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box("x"); + }); + + var __japgolly__hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw); + + var props$1 = props.a; + + var __japgolly__render_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024PC2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$PC2(props$1, children, __japgolly__hook1, __japgolly__hook2); + + var __japgolly__render_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eNone$0024.$m_s_None$())); + + var __japgolly__render_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw); + + var $$x6 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); + var $$x5 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024.$m_Ljapgolly_scalajs_react_hooks_HookCtx$(); + var this$5 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var $$x4 = this$5.always__F2(); + var $$x3 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$().propsChildren__F2(); + var $$x2 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$().refFullF__F2(); + var $$x1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$(); + var this$6 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + + var __japgolly__render_deps_state = $$x6.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__render_ctx, __japgolly__render_state, $$x5.reusabilityPC2__F2__F2__F2__F2__F2($$x4, $$x3, $$x2, $$x1.reusability__F2__F2(this$6.by_$eq$eq__F2()))); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + var c = __japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value.Ljapgolly_scalajs_react_hooks_HookCtx$PC0__f_propsChildren; + var inputRef = __japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value.Ljapgolly_scalajs_react_hooks_HookCtx$PC1__f_hook1; + var s = __japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value.Ljapgolly_scalajs_react_hooks_HookCtx$PC2__f_hook2; + var $$x8 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var $$x7 = $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$less.input__Ljapgolly_scalajs_react_vdom_HtmlTags$input$().Ljapgolly_scalajs_react_vdom_HtmlTags$input$__f_text.withRef__s_Option__Ljapgolly_scalajs_react_vdom_TagOf(new $j_scala$002eSome.$c_s_Some(inputRef)); + var array = [$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_value.$colon$eq__O__F2__Ljapgolly_scalajs_react_vdom_TagMod(s.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0], $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_PackageBase__f_vdomAttrVtString), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onChange.$eq$eq$greater__F1__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(e$2 => new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($p_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__onChange$1__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_callback_Trampoline(this, e$2, s))), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]; + var array$1 = [$$x7.apply__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(c))]; + return $$x8.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("div", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array$1)); + })).rawNode__sjs_js_$bar(); +}, "mdZWJ2Ot/KUCIZwAHIZGfXRzKCk="); +$c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$.prototype.japgolly$scalajs$react$test$emissions$RenderWithReuse$$$anonfun$CtxFn_P_PC$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s6(function (props) { + _s6(); + + var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren.$m_Ljapgolly_scalajs_react_PropsChildren$().fromRawProps__sjs_js_Object__sjs_js_Any(props); + + var __japgolly__hook1_raw = $i_react.useRef(null); + + var this$2 = $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook1_raw); + var ct = new $j_scala$002ereflect$002eClassTag$0024GenericClassTag.$c_s_reflect_ClassTag$GenericClassTag($j_org$002escalajs$002edom$002eHTMLInputElement.$d_Lorg_scalajs_dom_HTMLInputElement.getClassOf()); + + var __japgolly__hook1 = $j_japgolly$002escalajs$002ereact$002eRef$0024FullF.$f_Ljapgolly_scalajs_react_Ref$FullF__narrowOption__s_reflect_ClassTag__Ljapgolly_scalajs_react_Ref$FullF(this$2, ct); + + var __japgolly__hook2_raw = $i_react.useState(() => { + $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$(); + return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box("x"); + }); + + var __japgolly__hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw); + + var props$1 = props.a; + + var __japgolly__render_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024PC2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$PC2(props$1, children, __japgolly__hook1, __japgolly__hook2); + + var __japgolly__render_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eNone$0024.$m_s_None$())); + + var __japgolly__render_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw); + + var $$x6 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); + var $$x5 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024.$m_Ljapgolly_scalajs_react_hooks_HookCtx$(); + var this$5 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var $$x4 = this$5.always__F2(); + var $$x3 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$().propsChildren__F2(); + var $$x2 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$().refFullF__F2(); + var $$x1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$(); + var this$6 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + + var __japgolly__render_deps_state = $$x6.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__render_ctx, __japgolly__render_state, $$x5.reusabilityPC2__F2__F2__F2__F2__F2($$x4, $$x3, $$x2, $$x1.reusability__F2__F2(this$6.by_$eq$eq__F2()))); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + var $$x8 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var $$x7 = $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$less.input__Ljapgolly_scalajs_react_vdom_HtmlTags$input$().Ljapgolly_scalajs_react_vdom_HtmlTags$input$__f_text.withRef__s_Option__Ljapgolly_scalajs_react_vdom_TagOf(new $j_scala$002eSome.$c_s_Some(__japgolly__hook1)); + var array = [$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_value.$colon$eq__O__F2__Ljapgolly_scalajs_react_vdom_TagMod(__japgolly__hook2.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0], $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_PackageBase__f_vdomAttrVtString), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onChange.$eq$eq$greater__F1__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(e$2 => new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($p_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__onChange$2__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_callback_Trampoline(this, e$2, __japgolly__hook2))), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]; + var array$1 = [$$x7.apply__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(children))]; + return $$x8.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("div", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array$1)); + })).rawNode__sjs_js_$bar(); +}, "mdZWJ2Ot/KUCIZwAHIZGfXRzKCk="); +var $d_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$: 0 +}, false, "japgolly.scalajs.react.test.emissions.RenderWithReuse$", { + Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$ }; +$c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$; +var $n_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$; + +function $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$) { + $n_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$ = new $c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/RenderWithReuse-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/RenderWithReuse-out3.js new file mode 100644 index 000000000..a72560cd8 --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/RenderWithReuse-out3.js @@ -0,0 +1,514 @@ +'use strict'; + +import * as $i_react from "react"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Children from "./japgolly.scalajs.react.CtorType$Children.js"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Nullary from "./japgolly.scalajs.react.CtorType$Nullary.js"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Props from "./japgolly.scalajs.react.CtorType$Props.js"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024PropsAndChildren from "./japgolly.scalajs.react.CtorType$PropsAndChildren.js"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eNonEmptyRef$0024FullF from "./japgolly.scalajs.react.NonEmptyRef$FullF.js"; +import * as $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024package$0024PropsChildren$0024 from "./japgolly.scalajs.react.PropsChildren$package$PropsChildren$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eRef$0024 from "./japgolly.scalajs.react.Ref$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eRef$0024FullF from "./japgolly.scalajs.react.Ref$FullF.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusability from "./japgolly.scalajs.react.Reusability.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusable from "./japgolly.scalajs.react.Reusable.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024 from "./japgolly.scalajs.react.callback.Trampoline$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay from "./japgolly.scalajs.react.callback.Trampoline$Delay.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eGeneric$0024UnmountedRaw from "./japgolly.scalajs.react.component.Generic$UnmountedRaw.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024 from "./japgolly.scalajs.react.hooks.HookCtx$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2 from "./japgolly.scalajs.react.hooks.HookCtx$P2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P3 from "./japgolly.scalajs.react.hooks.HookCtx$P3.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024PC0 from "./japgolly.scalajs.react.hooks.HookCtx$PC0.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024PC2 from "./japgolly.scalajs.react.hooks.HookCtx$PC2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseCallbackArg$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseRefF from "./japgolly.scalajs.react.hooks.Hooks$UseRefF.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseStateF$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024 from "./japgolly.scalajs.react.internal.ShouldComponentUpdateComponent$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 from "./japgolly.scalajs.react.internal.Singleton$.js"; +import * as $j_japgolly$002escalajs$002ereact$002epackage$0024 from "./japgolly.scalajs.react.package$.js"; +import * as $j_japgolly$002escalajs$002ereact$002etest$002eemissions$002ePI from "./japgolly.scalajs.react.test.emissions.PI.js"; +import * as $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024 from "./japgolly.scalajs.react.util.DefaultEffects$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024 from "./japgolly.scalajs.react.util.EffectCallback$callback$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024 from "./japgolly.scalajs.react.vdom.Attr$EventCallback$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite from "./japgolly.scalajs.react.vdom.TagLite.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagMod from "./japgolly.scalajs.react.vdom.TagMod.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagOf$0024RefArg$0024 from "./japgolly.scalajs.react.vdom.TagOf$RefArg$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomElement$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode from "./japgolly.scalajs.react.vdom.VdomNode.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_org$002escalajs$002edom$002eHTMLInputElement from "./org.scalajs.dom.HTMLInputElement.js"; +import * as $j_scala$002eArray$0024 from "./scala.Array$.js"; +import * as $j_scala$002eFunction1 from "./scala.Function1.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; +import * as $j_scala$002escalajs$002eruntime$002eCompat$0024 from "./scala.scalajs.runtime.Compat$.js"; + +function $p_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__onChange$1__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_callback_Trampoline($thiz, s$2, e) { + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var r = $j_japgolly$002escalajs$002ereact$002eReusability.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__setState__Ljapgolly_scalajs_react_Reusable(s$2); + var ev$7 = r.value__O().apply__O__O(e.target.value); + return ev$7 === null ? null : ev$7.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline; +} + +export { $p_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__onChange$1__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_callback_Trampoline }; + +function $p_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__onChange$2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_callback_Trampoline($thiz, __japgolly__hook2$4, e) { + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var r = $j_japgolly$002escalajs$002ereact$002eReusability.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__setState__Ljapgolly_scalajs_react_Reusable(__japgolly__hook2$4); + var ev$8 = r.value__O().apply__O__O(e.target.value); + return ev$8 === null ? null : ev$8.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline; +} + +export { $p_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__onChange$2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_callback_Trampoline }; + +function $c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$() { + var _s = $RefreshSig$(), + _s2 = $RefreshSig$(), + _s3 = $RefreshSig$(), + _s4 = $RefreshSig$(), + _s5 = $RefreshSig$(), + _s6 = $RefreshSig$(); + + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_P = null; + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_CtxObj_P = null; + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_CtxFn_P = null; + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_P_PC = null; + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_CtxObj_P_PC = null; + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_CtxFn_P_PC = null; + $n_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$ = this; + + var rawComponent = props => { + _s(); + + var __japgolly__render_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eArray$0024.$m_s_None$())); + + var __japgolly__render_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw); + + var __japgolly__render_deps_state = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(props.a, __japgolly__render_state, $j_japgolly$002escalajs$002ereact$002etest$002eemissions$002ePI.$m_Ljapgolly_scalajs_react_test_emissions_PI$().Ljapgolly_scalajs_react_test_emissions_PI$__f_reusability); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + var _$1 = props.a; + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + + var v = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$()._toString__s_Product__T(_$1); + + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + return new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(v); + })).rawNode__O(); + }; + + _s(rawComponent, "LqO7qddGnL/1O/Kyd3Xtp6x9iJE="); + + var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$4 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_P = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$4.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); + + var rawComponent$2 = props$2 => { + _s2(); + + var __japgolly__hook1_raw = $i_react.useRef(100); + + var this$6 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); + + var __japgolly__hook1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseRefF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseRefF(__japgolly__hook1_raw, this$6.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + + var __japgolly__hook2_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(0)); + + var __japgolly__hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw); + + var props$1 = props$2.a; + + var __japgolly__render_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, __japgolly__hook1, __japgolly__hook2); + + var __japgolly__render_state_raw$1 = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eArray$0024.$m_s_None$())); + + var __japgolly__render_state$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw$1); + + var $$x6 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); + var $$x5 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024.$m_Ljapgolly_scalajs_react_hooks_HookCtx$(); + var this$8 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var $$x4 = this$8.Ljapgolly_scalajs_react_Reusability$__f_alwaysInstance; + var $$x3 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$().hooksUseRefF__F2(); + var $$x2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$(); + var this$9 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + + var __japgolly__render_deps_state$1 = $$x6.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__render_ctx, __japgolly__render_state$1, $$x5.reusabilityP2__F2__F2__F2__F2($$x4, $$x3, $$x2.reusability__F2__F2(this$9.by_$eq$eq__F2()))); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state$1.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + var δ = __japgolly__render_deps_state$1.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; + var ref = δ.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; + var s$1 = δ.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; + var this$21 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self$2 = "div"; + var $$x9 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + var v$1 = ref.Ljapgolly_scalajs_react_hooks_Hooks$UseRefF__f_raw.current | 0; + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + var $$x8 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(v$1); + var this$16 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self = "button"; + var xs = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + var f = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$2 => { + var _$2$1 = _$2 | 0; + + return 1 + _$2$1 | 0; + }); + var ev$2 = $j_japgolly$002escalajs$002ereact$002eNonEmptyRef$0024FullF.$f_Ljapgolly_scalajs_react_NonEmptyRef$FullF__mod__F1__O(ref, f); + return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(ev$2 === null ? null : ev$2.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline); + }), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)])); + var $$x7 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$16, self, xs); + var this$20 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self$1 = "button"; + var xs$1 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var r = $j_japgolly$002escalajs$002ereact$002eReusability.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(s$1); + var ev$3 = r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$3 => { + var _$3$1 = _$3 | 0; + + return 1 + _$3$1 | 0; + })); + return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(ev$3 === null ? null : ev$3.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline); + }), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)])); + var xs$2 = $$x9.wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([$$x8, $$x7, $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$20, self$1, xs$1)])); + return $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$21, self$2, xs$2); + })).rawNode__O(); + }; + + _s2(rawComponent$2, "N81TqRKjoN5vKcxkXvqCldke0YU="); + + var $$x10 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$22 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s$2 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonN__Ljapgolly_scalajs_react_internal_Singleton__Ljapgolly_scalajs_react_CtorType$Summoner($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$().Ljapgolly_scalajs_react_internal_Singleton$__f_BoxUnit); + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_CtxObj_P = $$x10.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$22.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent$2, s$2)); + + var rawComponent$3 = props$3 => { + _s3(); + + var __japgolly__hook1_raw$1 = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(20)); + + var __japgolly__hook1$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook1_raw$1); + + var __japgolly__hook2_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$().callback__Ljapgolly_scalajs_react_util_Effect$Dispatch__Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); + + var $$x11 = __japgolly__hook2_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_f$1; + var optionalParams$proxy1 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); + var f$proxy7 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + console.log("asd", ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy1)); + }); + + var __japgolly__hook2_jscb = $$x11.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy7)))); + + var __japgolly__hook2_raw$1 = $i_react.useCallback(__japgolly__hook2_jscb, []); + + var __japgolly__hook2$1 = __japgolly__hook2_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_g$1.apply__O__O(__japgolly__hook2_raw$1); + + var __japgolly__hook3_state = $i_react.useState(0); + + var __japgolly__hook3 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().useForceUpdateRaw__sjs_js_Tuple2__Ljapgolly_scalajs_react_Reusable(__japgolly__hook3_state); + + var props$4 = props$3.a; + + var __japgolly__render_ctx$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P3.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P3__O__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P3.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P3(), props$4, __japgolly__hook1$1, __japgolly__hook2$1, __japgolly__hook3); + + var __japgolly__render_state_raw$2 = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eArray$0024.$m_s_None$())); + + var __japgolly__render_state$2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw$2); + + var $$x15 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); + var $$x14 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024.$m_Ljapgolly_scalajs_react_hooks_HookCtx$(); + var $$x13 = $j_japgolly$002escalajs$002ereact$002etest$002eemissions$002ePI.$m_Ljapgolly_scalajs_react_test_emissions_PI$().Ljapgolly_scalajs_react_test_emissions_PI$__f_reusability; + var $$x12 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$(); + var this$27 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + + var __japgolly__render_deps_state$2 = $$x15.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__render_ctx$1, __japgolly__render_state$2, $$x14.reusabilityP3__F2__F2__F2__F2__F2($$x13, $$x12.reusability__F2__F2(this$27.by_$eq$eq__F2()), $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusableReusability__F2(), $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusableReusability__F2())); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state$2.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + var p = props$3.a; + var this$41 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self$5 = "div"; + var $$x19 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + var v$2 = "P=" + p + ", S=" + __japgolly__hook1$1.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + var $$x18 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(v$2); + var this$35 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self$3 = "button"; + var xs$3 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var r$1 = $j_japgolly$002escalajs$002ereact$002eReusability.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(__japgolly__hook1$1); + var ev$4 = r$1.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$4 => { + var _$4$1 = _$4 | 0; + + return 1 + _$4$1 | 0; + })); + return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(ev$4 === null ? null : ev$4.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline); + }), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)])); + var $$x17 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$35, self$3, xs$3); + var this$40 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self$4 = "button"; + var xs$4 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + + var ev$5 = __japgolly__hook2$1.value__O(); + + var ev$1 = ev$5 === null ? null : ev$5.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline; + var $$x16 = $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$m_Ljapgolly_scalajs_react_callback_CallbackTo$(); + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + + var ev$6 = __japgolly__hook3.value__O(); + + return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($$x16.$greater$greater$extension__Ljapgolly_scalajs_react_callback_Trampoline__Ljapgolly_scalajs_react_callback_Trampoline__Ljapgolly_scalajs_react_callback_Trampoline(ev$1, ev$6 === null ? null : ev$6.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline)); + }), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)])); + var xs$5 = $$x19.wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([$$x18, $$x17, $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$40, self$4, xs$4)])); + return $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$41, self$5, xs$5); + })).rawNode__O(); + }; + + _s3(rawComponent$3, "FfFcmS/xahfGPO7v/c1S2fZHBQE=", true); + + var $$x20 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$42 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s$3 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_CtxFn_P = $$x20.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$42.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent$3, s$3)); + + var rawComponent$4 = props$4$1 => { + _s4(); + + var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024package$0024PropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$package$PropsChildren$().fromRawProps__sjs_js_Object__O(props$4$1); + var props$5 = props$4$1.a; + + var __japgolly__render_ctx$2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024PC0.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$PC0__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024PC0.$c_Ljapgolly_scalajs_react_hooks_HookCtx$PC0(), props$5, children); + + var __japgolly__render_state_raw$3 = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eArray$0024.$m_s_None$())); + + var __japgolly__render_state$3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw$3); + + var __japgolly__render_deps_state$3 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__render_ctx$2, __japgolly__render_state$3, $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024.$m_Ljapgolly_scalajs_react_hooks_HookCtx$().reusabilityPC0__F2__F2__F2($j_japgolly$002escalajs$002ereact$002etest$002eemissions$002ePI.$m_Ljapgolly_scalajs_react_test_emissions_PI$().Ljapgolly_scalajs_react_test_emissions_PI$__f_reusability, $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$().propsChildren__F2())); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state$3.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + var p$1 = props$4$1.a; + var this$51 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self$6 = "div"; + var $$x21 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + var v$3 = "P=" + p$1; + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + var xs$6 = $$x21.wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(v$3), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(children))])); + return $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$51, self$6, xs$6); + })).rawNode__O(); + }; + + _s4(rawComponent$4, "L1iPDI2WUeUZjh7Tn4FDlDqxBDc="); + + var $$x22 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$52 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s$4 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonPC__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_P_PC = $$x22.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$52.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent$4, s$4)); + + var rawComponent$5 = props$5$1 => { + _s5(); + + var children$1 = $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024package$0024PropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$package$PropsChildren$().fromRawProps__sjs_js_Object__O(props$5$1); + + var __japgolly__hook1_raw$2 = $i_react.useRef(null); + + var this$54 = $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook1_raw$2); + var ct = new $j_scala$002eArray$0024.$c_s_reflect_ClassTag$GenericClassTag($j_org$002escalajs$002edom$002eHTMLInputElement.$d_Lorg_scalajs_dom_HTMLInputElement.getClassOf()); + + var __japgolly__hook1$2 = $j_japgolly$002escalajs$002ereact$002eRef$0024FullF.$f_Ljapgolly_scalajs_react_Ref$FullF__narrowOption__s_reflect_ClassTag__Ljapgolly_scalajs_react_Ref$FullF(this$54, ct); + + var __japgolly__hook2_raw$2 = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box("x")); + + var __japgolly__hook2$2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw$2); + + var props$6 = props$5$1.a; + + var __japgolly__render_ctx$3 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024PC2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$PC2(props$6, children$1, __japgolly__hook1$2, __japgolly__hook2$2); + + var __japgolly__render_state_raw$4 = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eArray$0024.$m_s_None$())); + + var __japgolly__render_state$4 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw$4); + + var $$x28 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); + var $$x27 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024.$m_Ljapgolly_scalajs_react_hooks_HookCtx$(); + var this$56 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var $$x26 = this$56.Ljapgolly_scalajs_react_Reusability$__f_alwaysInstance; + var $$x25 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$().propsChildren__F2(); + var $$x24 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$().refFullF__F2(); + var $$x23 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$(); + var this$57 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + + var __japgolly__render_deps_state$4 = $$x28.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__render_ctx$3, __japgolly__render_state$4, $$x27.reusabilityPC2__F2__F2__F2__F2__F2($$x26, $$x25, $$x24, $$x23.reusability__F2__F2(this$57.by_$eq$eq__F2()))); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state$4.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + var δ$1 = __japgolly__render_deps_state$4.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; + var c = δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$PC0__f_propsChildren; + var inputRef = δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$PC1__f_hook1; + var s$5 = δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$PC2__f_hook2; + var this$63 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self$7 = "div"; + var xs$7 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$less.input__Ljapgolly_scalajs_react_vdom_HtmlTags$input$().Ljapgolly_scalajs_react_vdom_HtmlTags$input$__f_text.withRef__s_Option__Ljapgolly_scalajs_react_vdom_TagOf($j_japgolly$002escalajs$002ereact$002evdom$002eTagOf$0024RefArg$0024.$m_Ljapgolly_scalajs_react_vdom_TagOf$RefArg$().set__Ljapgolly_scalajs_react_Ref$SetF__s_Option(inputRef)).apply__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf($j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_value.$colon$eq__O__F2__Ljapgolly_scalajs_react_vdom_TagMod(s$5.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0], $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_PackageBase__f_vdomAttrVtString), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onChange.$eq$eq$greater__F1__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(e => new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($p_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__onChange$1__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_callback_Trampoline(this, s$5, e))), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]))), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(c))])); + return $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$63, self$7, xs$7); + })).rawNode__O(); + }; + + _s5(rawComponent$5, "Nb2f/gvbdXTWnKivh/RajIDKBbc="); + + var $$x29 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$64 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s$6 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonC__Ljapgolly_scalajs_react_internal_Singleton__Ljapgolly_scalajs_react_CtorType$Summoner($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$().Ljapgolly_scalajs_react_internal_Singleton$__f_BoxUnit); + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_CtxObj_P_PC = $$x29.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$64.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent$5, s$6)); + + var rawComponent$6 = props$6$1 => { + _s6(); + + var children$2 = $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024package$0024PropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$package$PropsChildren$().fromRawProps__sjs_js_Object__O(props$6$1); + + var __japgolly__hook1_raw$3 = $i_react.useRef(null); + + var this$66 = $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook1_raw$3); + var ct$1 = new $j_scala$002eArray$0024.$c_s_reflect_ClassTag$GenericClassTag($j_org$002escalajs$002edom$002eHTMLInputElement.$d_Lorg_scalajs_dom_HTMLInputElement.getClassOf()); + + var __japgolly__hook1$3 = $j_japgolly$002escalajs$002ereact$002eRef$0024FullF.$f_Ljapgolly_scalajs_react_Ref$FullF__narrowOption__s_reflect_ClassTag__Ljapgolly_scalajs_react_Ref$FullF(this$66, ct$1); + + var __japgolly__hook2_raw$3 = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box("x")); + + var __japgolly__hook2$3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw$3); + + var props$7 = props$6$1.a; + + var __japgolly__render_ctx$4 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024PC2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$PC2(props$7, children$2, __japgolly__hook1$3, __japgolly__hook2$3); + + var __japgolly__render_state_raw$5 = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eArray$0024.$m_s_None$())); + + var __japgolly__render_state$5 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw$5); + + var $$x35 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); + var $$x34 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024.$m_Ljapgolly_scalajs_react_hooks_HookCtx$(); + var this$68 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var $$x33 = this$68.Ljapgolly_scalajs_react_Reusability$__f_alwaysInstance; + var $$x32 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$().propsChildren__F2(); + var $$x31 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$().refFullF__F2(); + var $$x30 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$(); + var this$69 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + + var __japgolly__render_deps_state$5 = $$x35.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__render_ctx$4, __japgolly__render_state$5, $$x34.reusabilityPC2__F2__F2__F2__F2__F2($$x33, $$x32, $$x31, $$x30.reusability__F2__F2(this$69.by_$eq$eq__F2()))); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state$5.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + props$6$1.a; + var this$75 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self$8 = "div"; + var xs$8 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$less.input__Ljapgolly_scalajs_react_vdom_HtmlTags$input$().Ljapgolly_scalajs_react_vdom_HtmlTags$input$__f_text.withRef__s_Option__Ljapgolly_scalajs_react_vdom_TagOf($j_japgolly$002escalajs$002ereact$002evdom$002eTagOf$0024RefArg$0024.$m_Ljapgolly_scalajs_react_vdom_TagOf$RefArg$().set__Ljapgolly_scalajs_react_Ref$SetF__s_Option(__japgolly__hook1$3)).apply__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf($j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_value.$colon$eq__O__F2__Ljapgolly_scalajs_react_vdom_TagMod(__japgolly__hook2$3.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0], $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_PackageBase__f_vdomAttrVtString), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onChange.$eq$eq$greater__F1__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(e$1 => new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($p_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__onChange$2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_callback_Trampoline(this, __japgolly__hook2$3, e$1))), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]))), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(children$2))])); + return $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$75, self$8, xs$8); + })).rawNode__O(); + }; + + _s6(rawComponent$6, "Q2EthKS++vBhx2pAlqNww9Pvaec="); + + var $$x36 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$76 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s$7 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonC__Ljapgolly_scalajs_react_internal_Singleton__Ljapgolly_scalajs_react_CtorType$Summoner($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$().Ljapgolly_scalajs_react_internal_Singleton$__f_BoxUnit); + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_CtxFn_P_PC = $$x36.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$76.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent$6, s$7)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$ }; +$c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$; + +function $h_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$ }; +$h_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$.prototype; + +$c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$.prototype.all__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot = function () { + return $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_ScalaFnComponent.apply__F1__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(p => { + var p$1 = p; + var this$33 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self = "div"; + var $$x6 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$(); + var c = this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_P; + var this$5 = c.ctor__Ljapgolly_scalajs_react_CtorType(); + var u = this$5.Ljapgolly_scalajs_react_CtorType$Props__f_construct.apply__O__O__O(p$1, this$5.Ljapgolly_scalajs_react_CtorType$Props__f_mods); + var n = u.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var $$x5 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n); + var c$1 = this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_CtxObj_P; + var u$1 = c$1.ctor__Ljapgolly_scalajs_react_CtorType().apply__O(); + var n$1 = u$1.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var $$x4 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n$1); + var c$2 = this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_CtxFn_P; + var this$12 = c$2.ctor__Ljapgolly_scalajs_react_CtorType(); + var u$2 = this$12.Ljapgolly_scalajs_react_CtorType$Props__f_construct.apply__O__O__O(p$1, this$12.Ljapgolly_scalajs_react_CtorType$Props__f_mods); + var n$2 = u$2.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var $$x3 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n$2); + var c$3 = this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_P_PC; + var this$18 = c$3.ctor__Ljapgolly_scalajs_react_CtorType(); + var children = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode.$d_Ljapgolly_scalajs_react_vdom_VdomNode.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(1))])); + var u$3 = this$18.Ljapgolly_scalajs_react_CtorType$PropsAndChildren__f_construct.apply__O__O__O__O(p$1, this$18.Ljapgolly_scalajs_react_CtorType$PropsAndChildren__f_mods, children); + var n$3 = u$3.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var $$x2 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n$3); + var c$4 = this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_CtxObj_P_PC; + var this$24 = c$4.ctor__Ljapgolly_scalajs_react_CtorType(); + var children$1 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode.$d_Ljapgolly_scalajs_react_vdom_VdomNode.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(2))])); + var u$4 = this$24.Ljapgolly_scalajs_react_CtorType$Children__f_construct.apply__O__O__O(this$24.Ljapgolly_scalajs_react_CtorType$Children__f_mods, children$1); + var n$4 = u$4.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var $$x1 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n$4); + var c$5 = this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$__f_CtxFn_P_PC; + var this$30 = c$5.ctor__Ljapgolly_scalajs_react_CtorType(); + var children$2 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode.$d_Ljapgolly_scalajs_react_vdom_VdomNode.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(3))])); + var u$5 = this$30.Ljapgolly_scalajs_react_CtorType$Children__f_construct.apply__O__O__O(this$30.Ljapgolly_scalajs_react_CtorType$Children__f_mods, children$2); + var n$5 = u$5.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var xs = $$x6.wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([$$x5, $$x4, $$x3, $$x2, $$x1, new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n$5)])); + return $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$33, self, xs); + }), $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null)); +}; + +var $d_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$: 0 +}, false, "japgolly.scalajs.react.test.emissions.RenderWithReuse$", { + Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$ }; +$c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$; +var $n_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$; + +function $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$) { + $n_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$ = new $c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuse$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/RenderWithReuseBy-out2.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/RenderWithReuseBy-out2.js new file mode 100644 index 000000000..aaa9d5964 --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/RenderWithReuseBy-out2.js @@ -0,0 +1,501 @@ +'use strict'; + +var _s = $RefreshSig$(), + _s2 = $RefreshSig$(), + _s3 = $RefreshSig$(), + _s4 = $RefreshSig$(), + _s5 = $RefreshSig$(), + _s6 = $RefreshSig$(); + +import * as $i_react from "react"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Children from "./japgolly.scalajs.react.CtorType$Children.js"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Nullary from "./japgolly.scalajs.react.CtorType$Nullary.js"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Props from "./japgolly.scalajs.react.CtorType$Props.js"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024PropsAndChildren from "./japgolly.scalajs.react.CtorType$PropsAndChildren.js"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eNonEmptyRef$0024FullF from "./japgolly.scalajs.react.NonEmptyRef$FullF.js"; +import * as $j_japgolly$002escalajs$002ereact$002ePropsChildren from "./japgolly.scalajs.react.PropsChildren.js"; +import * as $j_japgolly$002escalajs$002ereact$002eRef$0024 from "./japgolly.scalajs.react.Ref$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eRef$0024FullF from "./japgolly.scalajs.react.Ref$FullF.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusability from "./japgolly.scalajs.react.Reusability.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusable from "./japgolly.scalajs.react.Reusable.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eGeneric$0024UnmountedRaw from "./japgolly.scalajs.react.component.Generic$UnmountedRaw.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024 from "./japgolly.scalajs.react.hooks.HookCtx$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P1 from "./japgolly.scalajs.react.hooks.HookCtx$P1.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2 from "./japgolly.scalajs.react.hooks.HookCtx$P2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024PC0 from "./japgolly.scalajs.react.hooks.HookCtx$PC0.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024PC1 from "./japgolly.scalajs.react.hooks.HookCtx$PC1.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024PC2 from "./japgolly.scalajs.react.hooks.HookCtx$PC2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseCallbackArg$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseRefF from "./japgolly.scalajs.react.hooks.Hooks$UseRefF.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseStateF$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024 from "./japgolly.scalajs.react.internal.ShouldComponentUpdateComponent$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 from "./japgolly.scalajs.react.internal.Singleton$.js"; +import * as $j_japgolly$002escalajs$002ereact$002epackage$0024 from "./japgolly.scalajs.react.package$.js"; +import * as $j_japgolly$002escalajs$002ereact$002etest$002eemissions$002ePI from "./japgolly.scalajs.react.test.emissions.PI.js"; +import * as $j_japgolly$002escalajs$002ereact$002etest$002eemissions$002ePI$0024 from "./japgolly.scalajs.react.test.emissions.PI$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024 from "./japgolly.scalajs.react.util.DefaultEffects$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024 from "./japgolly.scalajs.react.util.EffectCallback$callback$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024 from "./japgolly.scalajs.react.vdom.Attr$EventCallback$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomElement$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_org$002escalajs$002edom$002eHTMLInputElement from "./org.scalajs.dom.HTMLInputElement.js"; +import * as $j_scala$002eArray$0024 from "./scala.Array$.js"; +import * as $j_scala$002eFunction1 from "./scala.Function1.js"; +import * as $j_scala$002eMatchError from "./scala.MatchError.js"; +import * as $j_scala$002eNone$0024 from "./scala.None$.js"; +import * as $j_scala$002eSome from "./scala.Some.js"; +import * as $j_scala$002eTuple4 from "./scala.Tuple4.js"; +import * as $j_scala$002ereflect$002eClassTag$0024GenericClassTag from "./scala.reflect.ClassTag$GenericClassTag.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; +import * as $j_scala$002escalajs$002eruntime$002eWrappedVarArgs from "./scala.scalajs.runtime.WrappedVarArgs.js"; + +function $p_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__onChange$1__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_callback_Trampoline($thiz, e, s$3) { + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var r = $j_japgolly$002escalajs$002ereact$002eReusability.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__setState__Ljapgolly_scalajs_react_Reusable(s$3); + return r.value__O().apply__O__O(e.target.value).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline; +} + +export { $p_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__onChange$1__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_callback_Trampoline }; + +function $p_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__onChange$2__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_callback_Trampoline($thiz, e, s$4) { + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var r = $j_japgolly$002escalajs$002ereact$002eReusability.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__setState__Ljapgolly_scalajs_react_Reusable(s$4); + return r.value__O().apply__O__O(e.target.value).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline; +} + +export { $p_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__onChange$2__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_callback_Trampoline }; + +function $c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$() { + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_P = null; + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_CtxObj_P = null; + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_CtxFn_P = null; + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_P_PC = null; + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_CtxObj_P_PC = null; + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_CtxFn_P_PC = null; + $n_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$ = this; + + var rawComponent = arg1$2 => $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$().japgolly$scalajs$react$test$emissions$RenderWithReuseBy$$$anonfun$P$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2); + + var $$x1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$1 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$(), null)); + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_P = $$x1.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$1.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); + + var rawComponent$2 = arg1$2$1 => $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$().japgolly$scalajs$react$test$emissions$RenderWithReuseBy$$$anonfun$CtxObj_P$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2$1); + + var $$x2 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$2 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s$1 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonN__Ljapgolly_scalajs_react_internal_Singleton__Ljapgolly_scalajs_react_CtorType$Summoner($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$().Ljapgolly_scalajs_react_internal_Singleton$__f_BoxUnit); + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_CtxObj_P = $$x2.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$2.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent$2, s$1)); + + var rawComponent$3 = arg1$2$2 => $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$().japgolly$scalajs$react$test$emissions$RenderWithReuseBy$$$anonfun$CtxFn_P$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2$2); + + var $$x3 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$3 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s$2 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$(), null)); + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_CtxFn_P = $$x3.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$3.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent$3, s$2)); + + var rawComponent$4 = arg1$2$3 => $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$().japgolly$scalajs$react$test$emissions$RenderWithReuseBy$$$anonfun$P_PC$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2$3); + + var $$x4 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$4 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s$3 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonPC__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$(), null)); + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_P_PC = $$x4.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$4.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent$4, s$3)); + + var rawComponent$5 = arg1$2$4 => $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$().japgolly$scalajs$react$test$emissions$RenderWithReuseBy$$$anonfun$CtxObj_P_PC$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2$4); + + var $$x5 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$5 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s$4 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonC__Ljapgolly_scalajs_react_internal_Singleton__Ljapgolly_scalajs_react_CtorType$Summoner($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$().Ljapgolly_scalajs_react_internal_Singleton$__f_BoxUnit); + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_CtxObj_P_PC = $$x5.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$5.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent$5, s$4)); + + var rawComponent$6 = arg1$2$5 => $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$().japgolly$scalajs$react$test$emissions$RenderWithReuseBy$$$anonfun$CtxFn_P_PC$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar(arg1$2$5); + + var $$x6 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$6 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s$5 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonC__Ljapgolly_scalajs_react_internal_Singleton__Ljapgolly_scalajs_react_CtorType$Summoner($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$().Ljapgolly_scalajs_react_internal_Singleton$__f_BoxUnit); + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_CtxFn_P_PC = $$x6.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$6.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent$6, s$5)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$ }; +$c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$; + +function $h_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$ }; +$h_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$.prototype; + +$c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$.prototype.all__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot = function () { + return $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_ScalaFnComponent.apply__F1__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(p$2 => { + var p = p$2; + var $$x6 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var c = $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$().Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_P; + var this$5 = c.ctor__Ljapgolly_scalajs_react_CtorType(); + var u = this$5.Ljapgolly_scalajs_react_CtorType$Props__f_construct.apply__O__O__O(p, this$5.Ljapgolly_scalajs_react_CtorType$Props__f_mods); + var n = u.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var $$x5 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n); + var c$1 = $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$().Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_CtxObj_P; + var u$1 = c$1.ctor__Ljapgolly_scalajs_react_CtorType().apply__O(); + var n$1 = u$1.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var $$x4 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n$1); + var c$2 = $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$().Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_CtxFn_P; + var this$12 = c$2.ctor__Ljapgolly_scalajs_react_CtorType(); + var u$2 = this$12.Ljapgolly_scalajs_react_CtorType$Props__f_construct.apply__O__O__O(p, this$12.Ljapgolly_scalajs_react_CtorType$Props__f_mods); + var n$2 = u$2.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var $$x3 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n$2); + var c$3 = $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$().Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_P_PC; + var this$21 = c$3.ctor__Ljapgolly_scalajs_react_CtorType(); + var array = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(1))]; + var children = new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array); + var u$3 = this$21.Ljapgolly_scalajs_react_CtorType$PropsAndChildren__f_construct.apply__O__O__O__O(p, this$21.Ljapgolly_scalajs_react_CtorType$PropsAndChildren__f_mods, children); + var n$3 = u$3.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var $$x2 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n$3); + var c$4 = $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$().Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_CtxObj_P_PC; + var this$30 = c$4.ctor__Ljapgolly_scalajs_react_CtorType(); + var array$1 = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(2))]; + var children$1 = new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array$1); + var u$4 = this$30.Ljapgolly_scalajs_react_CtorType$Children__f_construct.apply__O__O__O(this$30.Ljapgolly_scalajs_react_CtorType$Children__f_mods, children$1); + var n$4 = u$4.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var $$x1 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n$4); + var c$5 = $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$().Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_CtxFn_P_PC; + var this$39 = c$5.ctor__Ljapgolly_scalajs_react_CtorType(); + var array$2 = [($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(3))]; + var children$2 = new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array$2); + var u$5 = this$39.Ljapgolly_scalajs_react_CtorType$Children__f_construct.apply__O__O__O(this$39.Ljapgolly_scalajs_react_CtorType$Children__f_mods, children$2); + var n$5 = u$5.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var array$3 = [$$x5, $$x4, $$x3, $$x2, $$x1, new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n$5)]; + return $$x6.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("div", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array$3)); + }), $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$(), null))); +}; + +$c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$.prototype.japgolly$scalajs$react$test$emissions$RenderWithReuseBy$$$anonfun$P$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s(function (props) { + _s(); + + var __japgolly__render_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eNone$0024.$m_s_None$())); + + var __japgolly__render_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw); + + var __japgolly__render_deps_state = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(props.a.$plus__I__Ljapgolly_scalajs_react_test_emissions_PI(1), __japgolly__render_state, $j_japgolly$002escalajs$002ereact$002etest$002eemissions$002ePI$0024.$m_Ljapgolly_scalajs_react_test_emissions_PI$().Ljapgolly_scalajs_react_test_emissions_PI$__f_reusability); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + var v = $j_java$002elang$002eObject.$dp_toString__T(__japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value); + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + return new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(v); + })).rawNode__sjs_js_$bar(); +}, "M/diGxSdMncUUNsduOrYE4sj5Xs="); +$c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$.prototype.japgolly$scalajs$react$test$emissions$RenderWithReuseBy$$$anonfun$CtxObj_P$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s2(function (props) { + _s2(); + + var __japgolly__hook1_raw = $i_react.useRef(100); + + var this$2 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); + + var __japgolly__hook1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseRefF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseRefF(__japgolly__hook1_raw, this$2.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + + var __japgolly__hook2_raw = $i_react.useState(() => { + $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$(); + return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(0); + }); + + var __japgolly__hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw); + + var props$1 = props.a; + + var __japgolly__render_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, __japgolly__hook1, __japgolly__hook2); + + var __japgolly__render_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eNone$0024.$m_s_None$())); + + var __japgolly__render_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw); + + var $$x5 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); + var $$x4 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024.$m_Ljapgolly_scalajs_react_hooks_HookCtx$(); + var this$5 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var $$x3 = this$5.always__F2(); + var $$x2 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$().hooksUseRefF__F2(); + var $$x1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$(); + var this$6 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + + var __japgolly__render_deps_state = $$x5.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__render_ctx, __japgolly__render_state, $$x4.reusabilityP2__F2__F2__F2__F2($$x3, $$x2, $$x1.reusability__F2__F2(this$6.by_$eq$eq__F2()))); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + var ref = __japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; + var s = __japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; + var $$x10 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + var v = ref.Ljapgolly_scalajs_react_hooks_Hooks$UseRefF__f_raw.current | 0; + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + var $$x9 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(v); + var $$x8 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var array = [$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + var f = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$3$2 => { + var x$3 = x$3$2 | 0; + return 1 + x$3 | 0; + }); + return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002eNonEmptyRef$0024FullF.$f_Ljapgolly_scalajs_react_NonEmptyRef$FullF__mod__F1__O(ref, f).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline); + }), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]; + var $$x7 = $$x8.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("button", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); + var $$x6 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var array$1 = [$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var r = $j_japgolly$002escalajs$002ereact$002eReusability.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(s); + return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$4$2 => { + var x$4 = x$4$2 | 0; + return 1 + x$4 | 0; + })).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline); + }), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]; + var array$2 = [$$x9, $$x7, $$x6.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("button", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array$1))]; + return $$x10.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("div", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array$2)); + })).rawNode__sjs_js_$bar(); +}, "XQK4fClOIpcad1dd5v5cOG/c7eA="); +$c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$.prototype.japgolly$scalajs$react$test$emissions$RenderWithReuseBy$$$anonfun$CtxFn_P$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s3(function (props) { + _s3(); + + var __japgolly__hook1_raw = $i_react.useState(() => { + $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$(); + return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(20); + }); + + var __japgolly__hook1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook1_raw); + + var __japgolly__hook2_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$().callback__Ljapgolly_scalajs_react_util_Effect$Dispatch__Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); + + var __japgolly__hook2_jscb = __japgolly__hook2_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_f$1.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_package$__f_Callback.log__O__sci_Seq__Ljapgolly_scalajs_react_callback_Trampoline("asd", $j_scala$002eArray$0024.$m_sci_Nil$()))); + + var $$x1 = $i_react; + var a = []; + + var __japgolly__hook2_raw = $$x1.useCallback(__japgolly__hook2_jscb, a); + + var __japgolly__hook2 = __japgolly__hook2_arg.Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$$anon$1__f_g$1.apply__O__O(__japgolly__hook2_raw); + + var __japgolly__hook3_state = $i_react.useState(0); + + var __japgolly__hook3 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().useForceUpdateRaw__sjs_js_Tuple2__Ljapgolly_scalajs_react_Reusable(__japgolly__hook3_state); + + var __japgolly__render_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eNone$0024.$m_s_None$())); + + var __japgolly__render_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw); + + var $$x6 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); + var $$x5 = new $j_scala$002eTuple4.$c_T4(props.a, __japgolly__hook1, __japgolly__hook2, __japgolly__hook3); + var $$x4 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var $$x3 = $j_japgolly$002escalajs$002ereact$002etest$002eemissions$002ePI$0024.$m_Ljapgolly_scalajs_react_test_emissions_PI$().Ljapgolly_scalajs_react_test_emissions_PI$__f_reusability; + var $$x2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$(); + var this$7 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + + var __japgolly__render_deps_state = $$x6.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState($$x5, __japgolly__render_state, $$x4.tuple4__F2__F2__F2__F2__F2($$x3, $$x2.reusability__F2__F2(this$7.by_$eq$eq__F2()), $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusableReusability__F2(), $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusableReusability__F2())); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + var x1 = __japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; + + if (x1 !== null) { + var p = x1.T4__f__1; + var s = x1.T4__f__2; + var incES = x1.T4__f__3; + var fu = x1.T4__f__4; + var $$x11 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + var v = "P=" + p + ", S=" + s.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0]; + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + var $$x10 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(v); + var $$x9 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var array = [$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var r = $j_japgolly$002escalajs$002ereact$002eReusability.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(s); + return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(x$9$2 => { + var x$9 = x$9$2 | 0; + return 1 + x$9 | 0; + })).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline); + }), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]; + var $$x8 = $$x9.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("button", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); + var $$x7 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var array$1 = [$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$m_Ljapgolly_scalajs_react_callback_CallbackTo$().$greater$greater$extension__Ljapgolly_scalajs_react_callback_Trampoline__Ljapgolly_scalajs_react_callback_Trampoline__Ljapgolly_scalajs_react_callback_Trampoline(($j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(), incES.value__O()).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline, ($j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(), fu.value__O()).Ljapgolly_scalajs_react_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline))), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]; + var array$2 = [$$x10, $$x8, $$x7.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("button", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array$1))]; + return $$x11.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("div", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array$2)); + } else { + throw new $j_scala$002eMatchError.$c_s_MatchError(x1); + } + })).rawNode__sjs_js_$bar(); +}, "HLTVBa/zcnDZFbxAbCazifbqnDc=", true); +$c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$.prototype.japgolly$scalajs$react$test$emissions$RenderWithReuseBy$$$anonfun$P_PC$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s4(function (props) { + _s4(); + + var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren.$m_Ljapgolly_scalajs_react_PropsChildren$().fromRawProps__sjs_js_Object__sjs_js_Any(props); + + var __japgolly__render_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eNone$0024.$m_s_None$())); + + var __japgolly__render_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw); + + var __japgolly__render_deps_state = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(new $j_scala$002eArray$0024.$c_T2(props.a, new $j_japgolly$002escalajs$002ereact$002ePropsChildren.$c_Ljapgolly_scalajs_react_PropsChildren(children)), __japgolly__render_state, $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$().tuple2__F2__F2__F2($j_japgolly$002escalajs$002ereact$002etest$002eemissions$002ePI$0024.$m_Ljapgolly_scalajs_react_test_emissions_PI$().Ljapgolly_scalajs_react_test_emissions_PI$__f_reusability, $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$().propsChildren__F2())); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + var x1 = __japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; + + if (x1 !== null) { + var p = x1.T2__f__1; + var c = x1.T2__f__2.Ljapgolly_scalajs_react_PropsChildren__f_japgolly$scalajs$react$PropsChildren$$self; + var $$x1 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + var v = "P=" + p; + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + var array = [new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(v), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(c))]; + return $$x1.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("div", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)); + } else { + throw new $j_scala$002eMatchError.$c_s_MatchError(x1); + } + })).rawNode__sjs_js_$bar(); +}, "M/diGxSdMncUUNsduOrYE4sj5Xs="); +$c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$.prototype.japgolly$scalajs$react$test$emissions$RenderWithReuseBy$$$anonfun$CtxObj_P_PC$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s5(function (props) { + _s5(); + + var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren.$m_Ljapgolly_scalajs_react_PropsChildren$().fromRawProps__sjs_js_Object__sjs_js_Any(props); + + var __japgolly__hook1_raw = $i_react.useRef(null); + + var this$2 = $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook1_raw); + var ct = new $j_scala$002ereflect$002eClassTag$0024GenericClassTag.$c_s_reflect_ClassTag$GenericClassTag($j_org$002escalajs$002edom$002eHTMLInputElement.$d_Lorg_scalajs_dom_HTMLInputElement.getClassOf()); + + var __japgolly__hook1 = $j_japgolly$002escalajs$002ereact$002eRef$0024FullF.$f_Ljapgolly_scalajs_react_Ref$FullF__narrowOption__s_reflect_ClassTag__Ljapgolly_scalajs_react_Ref$FullF(this$2, ct); + + var __japgolly__hook2_raw = $i_react.useState(() => { + $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$(); + return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box("x"); + }); + + var __japgolly__hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw); + + var props$1 = props.a; + + var __japgolly__render_ctx = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024PC2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$PC2(props$1, children, __japgolly__hook1, __japgolly__hook2); + + var __japgolly__render_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eNone$0024.$m_s_None$())); + + var __japgolly__render_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw); + + var $$x6 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); + var $$x5 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024.$m_Ljapgolly_scalajs_react_hooks_HookCtx$(); + var this$5 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var $$x4 = this$5.always__F2(); + var $$x3 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$().propsChildren__F2(); + var $$x2 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$().refFullF__F2(); + var $$x1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$(); + var this$6 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + + var __japgolly__render_deps_state = $$x6.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__render_ctx, __japgolly__render_state, $$x5.reusabilityPC2__F2__F2__F2__F2__F2($$x4, $$x3, $$x2, $$x1.reusability__F2__F2(this$6.by_$eq$eq__F2()))); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + var c = __japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value.Ljapgolly_scalajs_react_hooks_HookCtx$PC0__f_propsChildren; + var inputRef = __japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value.Ljapgolly_scalajs_react_hooks_HookCtx$PC1__f_hook1; + var s = __japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value.Ljapgolly_scalajs_react_hooks_HookCtx$PC2__f_hook2; + var $$x8 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var $$x7 = $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$less.input__Ljapgolly_scalajs_react_vdom_HtmlTags$input$().Ljapgolly_scalajs_react_vdom_HtmlTags$input$__f_text.withRef__s_Option__Ljapgolly_scalajs_react_vdom_TagOf(new $j_scala$002eSome.$c_s_Some(inputRef)); + var array = [$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_value.$colon$eq__O__F2__Ljapgolly_scalajs_react_vdom_TagMod(s.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0], $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_PackageBase__f_vdomAttrVtString), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onChange.$eq$eq$greater__F1__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(e$2 => new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($p_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__onChange$1__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_callback_Trampoline(this, e$2, s))), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]; + var array$1 = [$$x7.apply__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(c))]; + return $$x8.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("div", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array$1)); + })).rawNode__sjs_js_$bar(); +}, "e3d1mc74fVY6+swSg3Db4+d+pYA="); +$c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$.prototype.japgolly$scalajs$react$test$emissions$RenderWithReuseBy$$$anonfun$CtxFn_P_PC$1__Ljapgolly_scalajs_react_internal_Box__sjs_js_$bar = _s6(function (props) { + _s6(); + + var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren.$m_Ljapgolly_scalajs_react_PropsChildren$().fromRawProps__sjs_js_Object__sjs_js_Any(props); + + var __japgolly__hook1_raw = $i_react.useRef(null); + + var this$2 = $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook1_raw); + var ct = new $j_scala$002ereflect$002eClassTag$0024GenericClassTag.$c_s_reflect_ClassTag$GenericClassTag($j_org$002escalajs$002edom$002eHTMLInputElement.$d_Lorg_scalajs_dom_HTMLInputElement.getClassOf()); + + var __japgolly__hook1 = $j_japgolly$002escalajs$002ereact$002eRef$0024FullF.$f_Ljapgolly_scalajs_react_Ref$FullF__narrowOption__s_reflect_ClassTag__Ljapgolly_scalajs_react_Ref$FullF(this$2, ct); + + var __japgolly__hook2_raw = $i_react.useState(() => { + $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$(); + return $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box("x"); + }); + + var __japgolly__hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw); + + var __japgolly__render_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eNone$0024.$m_s_None$())); + + var __japgolly__render_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw); + + var $$x7 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); + var $$x6 = new $j_scala$002eTuple4.$c_T4(props.a, new $j_japgolly$002escalajs$002ereact$002ePropsChildren.$c_Ljapgolly_scalajs_react_PropsChildren(children), __japgolly__hook1, __japgolly__hook2); + var $$x5 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var this$4 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var $$x4 = this$4.always__F2(); + var $$x3 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$().propsChildren__F2(); + var $$x2 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$().refFullF__F2(); + var $$x1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$(); + var this$5 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + + var __japgolly__render_deps_state = $$x7.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState($$x6, __japgolly__render_state, $$x5.tuple4__F2__F2__F2__F2__F2($$x4, $$x3, $$x2, $$x1.reusability__F2__F2(this$5.by_$eq$eq__F2()))); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + var x1 = __japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; + + if (x1 !== null) { + var c = x1.T4__f__2.Ljapgolly_scalajs_react_PropsChildren__f_japgolly$scalajs$react$PropsChildren$$self; + var inputRef = x1.T4__f__3; + var s = x1.T4__f__4; + var $$x9 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var $$x8 = $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$less.input__Ljapgolly_scalajs_react_vdom_HtmlTags$input$().Ljapgolly_scalajs_react_vdom_HtmlTags$input$__f_text.withRef__s_Option__Ljapgolly_scalajs_react_vdom_TagOf(new $j_scala$002eSome.$c_s_Some(inputRef)); + var array = [$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_value.$colon$eq__O__F2__Ljapgolly_scalajs_react_vdom_TagMod(s.Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$$anon$2__f_raw[0], $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_PackageBase__f_vdomAttrVtString), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onChange.$eq$eq$greater__F1__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(e$2 => new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($p_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__onChange$2__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_callback_Trampoline(this, e$2, s))), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]; + var array$1 = [$$x8.apply__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array)), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(c))]; + return $$x9.apply$extension__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf("div", new $j_scala$002escalajs$002eruntime$002eWrappedVarArgs.$c_sjsr_WrappedVarArgs(array$1)); + } else { + throw new $j_scala$002eMatchError.$c_s_MatchError(x1); + } + })).rawNode__sjs_js_$bar(); +}, "e3d1mc74fVY6+swSg3Db4+d+pYA="); +var $d_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$: 0 +}, false, "japgolly.scalajs.react.test.emissions.RenderWithReuseBy$", { + Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$ }; +$c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$; +var $n_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$; + +function $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$) { + $n_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$ = new $c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$ }; diff --git a/library/testEmissions/jvm/src/test/resources/rr-sjr/RenderWithReuseBy-out3.js b/library/testEmissions/jvm/src/test/resources/rr-sjr/RenderWithReuseBy-out3.js new file mode 100644 index 000000000..d3d2fa51b --- /dev/null +++ b/library/testEmissions/jvm/src/test/resources/rr-sjr/RenderWithReuseBy-out3.js @@ -0,0 +1,536 @@ +'use strict'; + +import * as $i_react from "react"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Children from "./japgolly.scalajs.react.CtorType$Children.js"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Nullary from "./japgolly.scalajs.react.CtorType$Nullary.js"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Props from "./japgolly.scalajs.react.CtorType$Props.js"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024PropsAndChildren from "./japgolly.scalajs.react.CtorType$PropsAndChildren.js"; +import * as $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024 from "./japgolly.scalajs.react.CtorType$Summoner$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eNonEmptyRef$0024FullF from "./japgolly.scalajs.react.NonEmptyRef$FullF.js"; +import * as $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024package$0024PropsChildren$0024 from "./japgolly.scalajs.react.PropsChildren$package$PropsChildren$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eRef$0024 from "./japgolly.scalajs.react.Ref$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eRef$0024FullF from "./japgolly.scalajs.react.Ref$FullF.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusability from "./japgolly.scalajs.react.Reusability.js"; +import * as $j_japgolly$002escalajs$002ereact$002eReusable from "./japgolly.scalajs.react.Reusable.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo from "./japgolly.scalajs.react.callback.CallbackTo.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024 from "./japgolly.scalajs.react.callback.Trampoline$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay from "./japgolly.scalajs.react.callback.Trampoline$Delay.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eGeneric$0024UnmountedRaw from "./japgolly.scalajs.react.component.Generic$UnmountedRaw.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024 from "./japgolly.scalajs.react.component.JsFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024 from "./japgolly.scalajs.react.component.ScalaFn$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024 from "./japgolly.scalajs.react.hooks.HookCtx$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2 from "./japgolly.scalajs.react.hooks.HookCtx$P2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024PC2 from "./japgolly.scalajs.react.hooks.HookCtx$PC2.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseCallbackArg$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseRefF from "./japgolly.scalajs.react.hooks.Hooks$UseRefF.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseState$.js"; +import * as $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF$0024 from "./japgolly.scalajs.react.hooks.Hooks$UseStateF$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024 from "./japgolly.scalajs.react.internal.Box$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024 from "./japgolly.scalajs.react.internal.ShouldComponentUpdateComponent$.js"; +import * as $j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024 from "./japgolly.scalajs.react.internal.Singleton$.js"; +import * as $j_japgolly$002escalajs$002ereact$002epackage$0024 from "./japgolly.scalajs.react.package$.js"; +import * as $j_japgolly$002escalajs$002ereact$002etest$002eemissions$002ePI from "./japgolly.scalajs.react.test.emissions.PI.js"; +import * as $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024 from "./japgolly.scalajs.react.util.DefaultEffects$.js"; +import * as $j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024 from "./japgolly.scalajs.react.util.EffectCallback$callback$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024 from "./japgolly.scalajs.react.vdom.Attr$EventCallback$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024 from "./japgolly.scalajs.react.vdom.Exports$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024 from "./japgolly.scalajs.react.vdom.HtmlTagOf$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite from "./japgolly.scalajs.react.vdom.TagLite.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagMod from "./japgolly.scalajs.react.vdom.TagMod.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eTagOf$0024RefArg$0024 from "./japgolly.scalajs.react.vdom.TagOf$RefArg$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomElement$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode from "./japgolly.scalajs.react.vdom.VdomNode.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024 from "./japgolly.scalajs.react.vdom.VdomNode$.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241 from "./japgolly.scalajs.react.vdom.VdomNode$$anon$1.js"; +import * as $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024 from "./japgolly.scalajs.react.vdom.html_$less$up$.js"; +import * as $j_java$002elang$002eObject from "./java.lang.Object.js"; +import * as $j_org$002escalajs$002edom$002eHTMLInputElement from "./org.scalajs.dom.HTMLInputElement.js"; +import * as $j_scala$002eArray$0024 from "./scala.Array$.js"; +import * as $j_scala$002eFunction1 from "./scala.Function1.js"; +import * as $j_scala$002eMatchError from "./scala.MatchError.js"; +import * as $j_scala$002eTuple4 from "./scala.Tuple4.js"; +import * as $j_scala$002escalajs$002eruntime$002eAnonFunction0 from "./scala.scalajs.runtime.AnonFunction0.js"; +import * as $j_scala$002escalajs$002eruntime$002eCompat$0024 from "./scala.scalajs.runtime.Compat$.js"; + +function $p_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__onChange$1__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_callback_Trampoline($thiz, s$3, e) { + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var r = $j_japgolly$002escalajs$002ereact$002eReusability.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__setState__Ljapgolly_scalajs_react_Reusable(s$3); + var ev$7 = r.value__O().apply__O__O(e.target.value); + return ev$7 === null ? null : ev$7.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline; +} + +export { $p_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__onChange$1__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_callback_Trampoline }; + +function $p_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__onChange$2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_callback_Trampoline($thiz, s$4, e) { + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var r = $j_japgolly$002escalajs$002ereact$002eReusability.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__setState__Ljapgolly_scalajs_react_Reusable(s$4); + var ev$8 = r.value__O().apply__O__O(e.target.value); + return ev$8 === null ? null : ev$8.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline; +} + +export { $p_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__onChange$2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_callback_Trampoline }; + +function $c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$() { + var _s = $RefreshSig$(), + _s2 = $RefreshSig$(), + _s3 = $RefreshSig$(), + _s4 = $RefreshSig$(), + _s5 = $RefreshSig$(), + _s6 = $RefreshSig$(); + + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_P = null; + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_CtxObj_P = null; + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_CtxFn_P = null; + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_P_PC = null; + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_CtxObj_P_PC = null; + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_CtxFn_P_PC = null; + $n_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$ = this; + + var rawComponent = props => { + _s(); + + var __japgolly__render_state_raw = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eArray$0024.$m_s_None$())); + + var __japgolly__render_state = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw); + + var $$x1 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); + var _$1 = props.a; + + var __japgolly__render_deps_state = $$x1.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(_$1.$plus__I__Ljapgolly_scalajs_react_test_emissions_PI(1), __japgolly__render_state, $j_japgolly$002escalajs$002ereact$002etest$002eemissions$002ePI.$m_Ljapgolly_scalajs_react_test_emissions_PI$().Ljapgolly_scalajs_react_test_emissions_PI$__f_reusability); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + var _$2 = __japgolly__render_deps_state.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + + var v = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$()._toString__s_Product__T(_$2); + + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + return new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(v); + })).rawNode__O(); + }; + + _s(rawComponent, "LqO7qddGnL/1O/Kyd3Xtp6x9iJE="); + + var $$x2 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$4 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_P = $$x2.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$4.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent, s)); + + var rawComponent$2 = props$2 => { + _s2(); + + var __japgolly__hook1_raw = $i_react.useRef(100); + + var this$6 = $j_japgolly$002escalajs$002ereact$002eutil$002eDefaultEffects$0024.$m_Ljapgolly_scalajs_react_util_DefaultEffects$(); + + var __japgolly__hook1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseRefF.$c_Ljapgolly_scalajs_react_hooks_Hooks$UseRefF(__japgolly__hook1_raw, this$6.Ljapgolly_scalajs_react_util_DefaultEffects$__f_Sync); + + var __japgolly__hook2_raw = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(0)); + + var __japgolly__hook2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw); + + var props$1 = props$2.a; + + var __japgolly__render_ctx = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$ct_Ljapgolly_scalajs_react_hooks_HookCtx$P2__O__O__O__(new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024P2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$P2(), props$1, __japgolly__hook1, __japgolly__hook2); + + var __japgolly__render_state_raw$1 = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eArray$0024.$m_s_None$())); + + var __japgolly__render_state$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw$1); + + var $$x7 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); + var $$x6 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024.$m_Ljapgolly_scalajs_react_hooks_HookCtx$(); + var this$8 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var $$x5 = this$8.Ljapgolly_scalajs_react_Reusability$__f_alwaysInstance; + var $$x4 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$().hooksUseRefF__F2(); + var $$x3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$(); + var this$9 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + + var __japgolly__render_deps_state$1 = $$x7.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__render_ctx, __japgolly__render_state$1, $$x6.reusabilityP2__F2__F2__F2__F2($$x5, $$x4, $$x3.reusability__F2__F2(this$9.by_$eq$eq__F2()))); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state$1.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + var δ = __japgolly__render_deps_state$1.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; + var ref = δ.Ljapgolly_scalajs_react_hooks_HookCtx$P1__f_hook1; + var s$1 = δ.Ljapgolly_scalajs_react_hooks_HookCtx$P2__f_hook2; + var this$21 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self$2 = "div"; + var $$x10 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + var v$1 = ref.Ljapgolly_scalajs_react_hooks_Hooks$UseRefF__f_raw.current | 0; + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + var $$x9 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(v$1); + var this$16 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self = "button"; + var xs = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + var f = new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$3 => { + var _$3$1 = _$3 | 0; + + return 1 + _$3$1 | 0; + }); + var ev$2 = $j_japgolly$002escalajs$002ereact$002eNonEmptyRef$0024FullF.$f_Ljapgolly_scalajs_react_NonEmptyRef$FullF__mod__F1__O(ref, f); + return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(ev$2 === null ? null : ev$2.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline); + }), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)])); + var $$x8 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$16, self, xs); + var this$20 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self$1 = "button"; + var xs$1 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var r = $j_japgolly$002escalajs$002ereact$002eReusability.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(s$1); + var ev$3 = r.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$4 => { + var _$4$1 = _$4 | 0; + + return 1 + _$4$1 | 0; + })); + return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(ev$3 === null ? null : ev$3.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline); + }), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)])); + var xs$2 = $$x10.wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([$$x9, $$x8, $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$20, self$1, xs$1)])); + return $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$21, self$2, xs$2); + })).rawNode__O(); + }; + + _s2(rawComponent$2, "N81TqRKjoN5vKcxkXvqCldke0YU="); + + var $$x11 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$22 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s$2 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonN__Ljapgolly_scalajs_react_internal_Singleton__Ljapgolly_scalajs_react_CtorType$Summoner($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$().Ljapgolly_scalajs_react_internal_Singleton$__f_BoxUnit); + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_CtxObj_P = $$x11.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$22.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent$2, s$2)); + + var rawComponent$3 = props$3 => { + _s3(); + + var __japgolly__hook1_raw$1 = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box(20)); + + var __japgolly__hook1$1 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook1_raw$1); + + var __japgolly__hook2_arg = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseCallbackArg$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg$().callback__Ljapgolly_scalajs_react_util_Effect$Dispatch__Ljapgolly_scalajs_react_hooks_Hooks$UseCallbackArg($j_japgolly$002escalajs$002ereact$002eutil$002eEffectCallback$0024callback$0024.$m_Ljapgolly_scalajs_react_util_EffectCallback$callback$()); + + var $$x12 = __japgolly__hook2_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_f$1; + var optionalParams$proxy1 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().genericWrapArray__O__sci_ArraySeq(new $j_java$002elang$002eObject.$ac_O([])); + var f$proxy7 = new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + console.log("asd", ...$j_scala$002escalajs$002eruntime$002eCompat$0024.$m_sjsr_Compat$().toJSVarArgsImpl__sci_Seq__sjs_js_Array(optionalParams$proxy1)); + }); + + var __japgolly__hook2_jscb = $$x12.apply__O__O(new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(($j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024.$m_Ljapgolly_scalajs_react_callback_Trampoline$(), new $j_japgolly$002escalajs$002ereact$002ecallback$002eTrampoline$0024Delay.$c_Ljapgolly_scalajs_react_callback_Trampoline$Delay(f$proxy7)))); + + var __japgolly__hook2_raw$1 = $i_react.useCallback(__japgolly__hook2_jscb, []); + + var __japgolly__hook2$1 = __japgolly__hook2_arg.Ljapgolly_scalajs_react_hooks_Hooks$$anon$1__f_g$1.apply__O__O(__japgolly__hook2_raw$1); + + var __japgolly__hook3_state = $i_react.useState(0); + + var __japgolly__hook3 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$().useForceUpdateRaw__sjs_js_Tuple2__Ljapgolly_scalajs_react_Reusable(__japgolly__hook3_state); + + var __japgolly__render_state_raw$2 = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eArray$0024.$m_s_None$())); + + var __japgolly__render_state$2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw$2); + + var $$x17 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); + var _$5 = props$3.a; + var $$x16 = new $j_scala$002eTuple4.$c_T4(_$5, __japgolly__hook1$1, __japgolly__hook2$1, __japgolly__hook3); + var $$x15 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var $$x14 = $j_japgolly$002escalajs$002ereact$002etest$002eemissions$002ePI.$m_Ljapgolly_scalajs_react_test_emissions_PI$().Ljapgolly_scalajs_react_test_emissions_PI$__f_reusability; + var $$x13 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$(); + var this$27 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + + var __japgolly__render_deps_state$2 = $$x17.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState($$x16, __japgolly__render_state$2, $$x15.tuple4__F2__F2__F2__F2__F2($$x14, $$x13.reusability__F2__F2(this$27.by_$eq$eq__F2()), $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusableReusability__F2(), $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$().reusableReusability__F2())); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state$2.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + var x$1 = __japgolly__render_deps_state$2.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; + + if (x$1 !== null) { + var p = x$1.T4__f__1; + var s$3 = x$1.T4__f__2; + var incES = x$1.T4__f__3; + var fu = x$1.T4__f__4; + var this$41 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self$5 = "div"; + var $$x21 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + var v$2 = "P=" + p + ", S=" + s$3.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0]; + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + var $$x20 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(v$2); + var this$35 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self$3 = "button"; + var xs$3 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var r$1 = $j_japgolly$002escalajs$002ereact$002eReusability.$f_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__modState__Ljapgolly_scalajs_react_Reusable(s$3); + var ev$4 = r$1.value__O().apply__O__O(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(_$9 => { + var _$9$1 = _$9 | 0; + + return 1 + _$9$1 | 0; + })); + return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo(ev$4 === null ? null : ev$4.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline); + }), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)])); + var $$x19 = $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$35, self$3, xs$3); + var this$40 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self$4 = "button"; + var xs$4 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var ev$5 = incES.value__O(); + var ev$1 = ev$5 === null ? null : ev$5.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline; + var $$x18 = $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$m_Ljapgolly_scalajs_react_callback_CallbackTo$(); + $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusable$(); + var ev$6 = fu.value__O(); + return new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($$x18.$greater$greater$extension__Ljapgolly_scalajs_react_callback_Trampoline__Ljapgolly_scalajs_react_callback_Trampoline__Ljapgolly_scalajs_react_callback_Trampoline(ev$1, ev$6 === null ? null : ev$6.Ljapgolly_scalajs_react_callback_CallbackTo__f_trampoline)); + }), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)])); + var xs$5 = $$x21.wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([$$x20, $$x19, $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$40, self$4, xs$4)])); + return $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$41, self$5, xs$5); + } + + ; + throw new $j_scala$002eMatchError.$c_s_MatchError(x$1); + })).rawNode__O(); + }; + + _s3(rawComponent$3, "FfFcmS/xahfGPO7v/c1S2fZHBQE=", true); + + var $$x22 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$42 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s$4 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_CtxFn_P = $$x22.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$42.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent$3, s$4)); + + var rawComponent$4 = props$4 => { + _s4(); + + var children = $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024package$0024PropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$package$PropsChildren$().fromRawProps__sjs_js_Object__O(props$4); + + var __japgolly__render_state_raw$3 = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eArray$0024.$m_s_None$())); + + var __japgolly__render_state$3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw$3); + + var $$x23 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); + var _$10 = props$4.a; + + var __japgolly__render_deps_state$3 = $$x23.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(new $j_scala$002eArray$0024.$c_T2(_$10, children), __japgolly__render_state$3, $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$().tuple2__F2__F2__F2($j_japgolly$002escalajs$002ereact$002etest$002eemissions$002ePI.$m_Ljapgolly_scalajs_react_test_emissions_PI$().Ljapgolly_scalajs_react_test_emissions_PI$__f_reusability, $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$().propsChildren__F2())); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state$3.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + var x$1$1 = __japgolly__render_deps_state$3.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; + + if (x$1$1 !== null) { + var p$1 = x$1$1.T2__f__1; + var c = x$1$1.T2__f__2; + var this$51 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self$6 = "div"; + var $$x24 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + var v$3 = "P=" + p$1; + $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(); + var xs$6 = $$x24.wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(v$3), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(c))])); + return $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$51, self$6, xs$6); + } + + ; + throw new $j_scala$002eMatchError.$c_s_MatchError(x$1$1); + })).rawNode__O(); + }; + + _s4(rawComponent$4, "L1iPDI2WUeUZjh7Tn4FDlDqxBDc="); + + var $$x25 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$52 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s$5 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonPC__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null); + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_P_PC = $$x25.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$52.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent$4, s$5)); + + var rawComponent$5 = props$5 => { + _s5(); + + var children$1 = $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024package$0024PropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$package$PropsChildren$().fromRawProps__sjs_js_Object__O(props$5); + + var __japgolly__hook1_raw$2 = $i_react.useRef(null); + + var this$54 = $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook1_raw$2); + var ct = new $j_scala$002eArray$0024.$c_s_reflect_ClassTag$GenericClassTag($j_org$002escalajs$002edom$002eHTMLInputElement.$d_Lorg_scalajs_dom_HTMLInputElement.getClassOf()); + + var __japgolly__hook1$2 = $j_japgolly$002escalajs$002ereact$002eRef$0024FullF.$f_Ljapgolly_scalajs_react_Ref$FullF__narrowOption__s_reflect_ClassTag__Ljapgolly_scalajs_react_Ref$FullF(this$54, ct); + + var __japgolly__hook2_raw$2 = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box("x")); + + var __japgolly__hook2$2 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw$2); + + var props$6 = props$5.a; + + var __japgolly__render_ctx$1 = new $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024PC2.$c_Ljapgolly_scalajs_react_hooks_HookCtx$PC2(props$6, children$1, __japgolly__hook1$2, __japgolly__hook2$2); + + var __japgolly__render_state_raw$4 = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eArray$0024.$m_s_None$())); + + var __japgolly__render_state$4 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw$4); + + var $$x31 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); + var $$x30 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHookCtx$0024.$m_Ljapgolly_scalajs_react_hooks_HookCtx$(); + var this$56 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var $$x29 = this$56.Ljapgolly_scalajs_react_Reusability$__f_alwaysInstance; + var $$x28 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$().propsChildren__F2(); + var $$x27 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$().refFullF__F2(); + var $$x26 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$(); + var this$57 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + + var __japgolly__render_deps_state$4 = $$x31.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState(__japgolly__render_ctx$1, __japgolly__render_state$4, $$x30.reusabilityPC2__F2__F2__F2__F2__F2($$x29, $$x28, $$x27, $$x26.reusability__F2__F2(this$57.by_$eq$eq__F2()))); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state$4.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + var δ$1 = __japgolly__render_deps_state$4.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; + var c$1 = δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$PC0__f_propsChildren; + var inputRef = δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$PC1__f_hook1; + var s$6 = δ$1.Ljapgolly_scalajs_react_hooks_HookCtx$PC2__f_hook2; + var this$63 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self$7 = "div"; + var xs$7 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$less.input__Ljapgolly_scalajs_react_vdom_HtmlTags$input$().Ljapgolly_scalajs_react_vdom_HtmlTags$input$__f_text.withRef__s_Option__Ljapgolly_scalajs_react_vdom_TagOf($j_japgolly$002escalajs$002ereact$002evdom$002eTagOf$0024RefArg$0024.$m_Ljapgolly_scalajs_react_vdom_TagOf$RefArg$().set__Ljapgolly_scalajs_react_Ref$SetF__s_Option(inputRef)).apply__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf($j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_value.$colon$eq__O__F2__Ljapgolly_scalajs_react_vdom_TagMod(s$6.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0], $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_PackageBase__f_vdomAttrVtString), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onChange.$eq$eq$greater__F1__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(e => new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($p_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__onChange$1__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_callback_Trampoline(this, s$6, e))), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]))), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(c$1))])); + return $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$63, self$7, xs$7); + })).rawNode__O(); + }; + + _s5(rawComponent$5, "Nb2f/gvbdXTWnKivh/RajIDKBbc="); + + var $$x32 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$64 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s$7 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonC__Ljapgolly_scalajs_react_internal_Singleton__Ljapgolly_scalajs_react_CtorType$Summoner($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$().Ljapgolly_scalajs_react_internal_Singleton$__f_BoxUnit); + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_CtxObj_P_PC = $$x32.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$64.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent$5, s$7)); + + var rawComponent$6 = props$6$1 => { + _s6(); + + var children$2 = $j_japgolly$002escalajs$002ereact$002ePropsChildren$0024package$0024PropsChildren$0024.$m_Ljapgolly_scalajs_react_PropsChildren$package$PropsChildren$().fromRawProps__sjs_js_Object__O(props$6$1); + + var __japgolly__hook1_raw$3 = $i_react.useRef(null); + + var this$66 = $j_japgolly$002escalajs$002ereact$002eRef$0024.$m_Ljapgolly_scalajs_react_Ref$().fromJs__Ljapgolly_scalajs_react_facade_React$RefHandle__Ljapgolly_scalajs_react_Ref$FullF(__japgolly__hook1_raw$3); + var ct$1 = new $j_scala$002eArray$0024.$c_s_reflect_ClassTag$GenericClassTag($j_org$002escalajs$002edom$002eHTMLInputElement.$d_Lorg_scalajs_dom_HTMLInputElement.getClassOf()); + + var __japgolly__hook1$3 = $j_japgolly$002escalajs$002ereact$002eRef$0024FullF.$f_Ljapgolly_scalajs_react_Ref$FullF__narrowOption__s_reflect_ClassTag__Ljapgolly_scalajs_react_Ref$FullF(this$66, ct$1); + + var __japgolly__hook2_raw$3 = $i_react.useState(() => $j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box("x")); + + var __japgolly__hook2$3 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__hook2_raw$3); + + var __japgolly__render_state_raw$5 = $i_react.useState($j_japgolly$002escalajs$002ereact$002einternal$002eBox$0024.$m_Ljapgolly_scalajs_react_internal_Box$().apply__O__Ljapgolly_scalajs_react_internal_Box($j_scala$002eArray$0024.$m_s_None$())); + + var __japgolly__render_state$5 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseState$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseState$().fromJsBoxed__sjs_js_Tuple2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF(__japgolly__render_state_raw$5); + + var $$x39 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_hooks_CustomHook$(); + var _$12 = props$6$1.a; + var $$x38 = new $j_scala$002eTuple4.$c_T4(_$12, children$2, __japgolly__hook1$3, __japgolly__hook2$3); + var $$x37 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var this$68 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + var $$x36 = this$68.Ljapgolly_scalajs_react_Reusability$__f_alwaysInstance; + var $$x35 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$().propsChildren__F2(); + var $$x34 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$().refFullF__F2(); + var $$x33 = $j_japgolly$002escalajs$002ereact$002ehooks$002eHooks$0024UseStateF$0024.$m_Ljapgolly_scalajs_react_hooks_Hooks$UseStateF$(); + var this$69 = $j_japgolly$002escalajs$002ereact$002eReusability.$m_Ljapgolly_scalajs_react_Reusability$(); + + var __japgolly__render_deps_state$5 = $$x39.reusableDepsLogic__O__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__F2__Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState($$x38, __japgolly__render_state$5, $$x37.tuple4__F2__F2__F2__F2__F2($$x36, $$x35, $$x34, $$x33.reusability__F2__F2(this$69.by_$eq$eq__F2()))); + + return $j_japgolly$002escalajs$002ereact$002einternal$002eShouldComponentUpdateComponent$0024.$m_Ljapgolly_scalajs_react_internal_ShouldComponentUpdateComponent$().apply__I__F0__Ljapgolly_scalajs_react_vdom_VdomNode(__japgolly__render_deps_state$5.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_rev, new $j_scala$002escalajs$002eruntime$002eAnonFunction0.$c_sjsr_AnonFunction0(() => { + var x$1$2 = __japgolly__render_deps_state$5.Ljapgolly_scalajs_react_hooks_CustomHook$ReusableDepState__f_value; + + if (x$1$2 !== null) { + var c$2 = x$1$2.T4__f__2; + var inputRef$1 = x$1$2.T4__f__3; + var s$8 = x$1$2.T4__f__4; + var this$75 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self$8 = "div"; + var xs$8 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$less.input__Ljapgolly_scalajs_react_vdom_HtmlTags$input$().Ljapgolly_scalajs_react_vdom_HtmlTags$input$__f_text.withRef__s_Option__Ljapgolly_scalajs_react_vdom_TagOf($j_japgolly$002escalajs$002ereact$002evdom$002eTagOf$0024RefArg$0024.$m_Ljapgolly_scalajs_react_vdom_TagOf$RefArg$().set__Ljapgolly_scalajs_react_Ref$SetF__s_Option(inputRef$1)).apply__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf($j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([$j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_value.$colon$eq__O__F2__Ljapgolly_scalajs_react_vdom_TagMod(s$8.Ljapgolly_scalajs_react_hooks_Hooks$$anon$2__f_raw[0], $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_PackageBase__f_vdomAttrVtString), $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$().Ljapgolly_scalajs_react_vdom_html_$less$up$__f_$up.Ljapgolly_scalajs_react_vdom_HtmlAttrAndStyles$__f_onChange.$eq$eq$greater__F1__F1__Ljapgolly_scalajs_react_vdom_TagMod(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(e$1 => new $j_japgolly$002escalajs$002ereact$002ecallback$002eCallbackTo.$c_Ljapgolly_scalajs_react_callback_CallbackTo($p_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__onChange$2__Ljapgolly_scalajs_react_hooks_Hooks$UseStateF__Ljapgolly_scalajs_react_facade_SyntheticEvent__Ljapgolly_scalajs_react_callback_Trampoline(this, s$8, e$1))), $j_japgolly$002escalajs$002ereact$002evdom$002eAttr$0024EventCallback$0024.$m_Ljapgolly_scalajs_react_vdom_Attr$EventCallback$().Ljapgolly_scalajs_react_vdom_Attr$EventCallback$__f_defaultSync)]))), ($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(c$2))])); + return $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$75, self$8, xs$8); + } + + ; + throw new $j_scala$002eMatchError.$c_s_MatchError(x$1$2); + })).rawNode__O(); + }; + + _s6(rawComponent$6, "Q2EthKS++vBhx2pAlqNww9Pvaec="); + + var $$x40 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eScalaFn$0024.$m_Ljapgolly_scalajs_react_component_ScalaFn$(); + var this$76 = $j_japgolly$002escalajs$002ereact$002ecomponent$002eJsFn$0024.$m_Ljapgolly_scalajs_react_component_JsFn$(); + var s$9 = $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonC__Ljapgolly_scalajs_react_internal_Singleton__Ljapgolly_scalajs_react_CtorType$Summoner($j_japgolly$002escalajs$002ereact$002einternal$002eSingleton$0024.$m_Ljapgolly_scalajs_react_internal_Singleton$().Ljapgolly_scalajs_react_internal_Singleton$__f_BoxUnit); + this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_CtxFn_P_PC = $$x40.fromBoxed__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(this$76.force__O__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(rawComponent$6, s$9)); +} + +export { $c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$ }; +$c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$.prototype = new $j_java$002elang$002eObject.$h_O(); +$c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$.prototype.constructor = $c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$; + +function $h_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$() {} + +export { $h_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$ }; +$h_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$.prototype = $c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$.prototype; + +$c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$.prototype.all__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot = function () { + return $j_japgolly$002escalajs$002ereact$002epackage$0024.$m_Ljapgolly_scalajs_react_package$().Ljapgolly_scalajs_react_internal_CoreGeneralF__f_ScalaFnComponent.apply__F1__Ljapgolly_scalajs_react_CtorType$Summoner__Ljapgolly_scalajs_react_component_JsBaseComponentTemplate$ComponentWithRoot(new $j_scala$002eFunction1.$c_sjsr_AnonFunction1(p => { + var p$1 = p; + var this$33 = $j_japgolly$002escalajs$002ereact$002evdom$002eHtmlTagOf$0024.$m_Ljapgolly_scalajs_react_vdom_HtmlTagOf$(); + $j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(); + $j_japgolly$002escalajs$002ereact$002evdom$002eExports$0024.$m_Ljapgolly_scalajs_react_vdom_Exports$(); + var self = "div"; + var $$x6 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$(); + var c = this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_P; + var this$5 = c.ctor__Ljapgolly_scalajs_react_CtorType(); + var u = this$5.Ljapgolly_scalajs_react_CtorType$Props__f_construct.apply__O__O__O(p$1, this$5.Ljapgolly_scalajs_react_CtorType$Props__f_mods); + var n = u.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var $$x5 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n); + var c$1 = this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_CtxObj_P; + var u$1 = c$1.ctor__Ljapgolly_scalajs_react_CtorType().apply__O(); + var n$1 = u$1.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var $$x4 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n$1); + var c$2 = this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_CtxFn_P; + var this$12 = c$2.ctor__Ljapgolly_scalajs_react_CtorType(); + var u$2 = this$12.Ljapgolly_scalajs_react_CtorType$Props__f_construct.apply__O__O__O(p$1, this$12.Ljapgolly_scalajs_react_CtorType$Props__f_mods); + var n$2 = u$2.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var $$x3 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n$2); + var c$3 = this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_P_PC; + var this$18 = c$3.ctor__Ljapgolly_scalajs_react_CtorType(); + var children = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode.$d_Ljapgolly_scalajs_react_vdom_VdomNode.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(1))])); + var u$3 = this$18.Ljapgolly_scalajs_react_CtorType$PropsAndChildren__f_construct.apply__O__O__O__O(p$1, this$18.Ljapgolly_scalajs_react_CtorType$PropsAndChildren__f_mods, children); + var n$3 = u$3.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var $$x2 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n$3); + var c$4 = this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_CtxObj_P_PC; + var this$24 = c$4.ctor__Ljapgolly_scalajs_react_CtorType(); + var children$1 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode.$d_Ljapgolly_scalajs_react_vdom_VdomNode.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(2))])); + var u$4 = this$24.Ljapgolly_scalajs_react_CtorType$Children__f_construct.apply__O__O__O(this$24.Ljapgolly_scalajs_react_CtorType$Children__f_mods, children$1); + var n$4 = u$4.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var $$x1 = new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n$4); + var c$5 = this.Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$__f_CtxFn_P_PC; + var this$30 = c$5.ctor__Ljapgolly_scalajs_react_CtorType(); + var children$2 = $j_scala$002eArray$0024.$m_sr_ScalaRunTime$().wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode.$d_Ljapgolly_scalajs_react_vdom_VdomNode.getArrayOf().constr)([($j_japgolly$002escalajs$002ereact$002evdom$002ehtml$005f$0024less$0024up$0024.$m_Ljapgolly_scalajs_react_vdom_html_$less$up$(), $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024.$m_Ljapgolly_scalajs_react_vdom_VdomNode$(), new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomNode$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomNode$$anon$1(3))])); + var u$5 = this$30.Ljapgolly_scalajs_react_CtorType$Children__f_construct.apply__O__O__O(this$30.Ljapgolly_scalajs_react_CtorType$Children__f_mods, children$2); + var n$5 = u$5.raw__Ljapgolly_scalajs_react_facade_React$ComponentElement(); + var xs = $$x6.wrapRefArray__AO__sci_ArraySeq(new ($j_japgolly$002escalajs$002ereact$002evdom$002eTagMod.$d_Ljapgolly_scalajs_react_vdom_TagMod.getArrayOf().constr)([$$x5, $$x4, $$x3, $$x2, $$x1, new $j_japgolly$002escalajs$002ereact$002evdom$002eVdomElement$0024$0024anon$00241.$c_Ljapgolly_scalajs_react_vdom_VdomElement$$anon$1(n$5)])); + return $j_japgolly$002escalajs$002ereact$002evdom$002eTagLite.$f_Ljapgolly_scalajs_react_vdom_TagLite__apply__T__sci_Seq__Ljapgolly_scalajs_react_vdom_TagOf(this$33, self, xs); + }), $j_japgolly$002escalajs$002ereact$002eCtorType$0024Summoner$0024.$m_Ljapgolly_scalajs_react_CtorType$Summoner$().summonP__Ljapgolly_scalajs_react_internal_Singleton$Not__Ljapgolly_scalajs_react_CtorType$Summoner(null)); +}; + +var $d_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$ = new $j_java$002elang$002eObject.$TypeData().initClass({ + Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$: 0 +}, false, "japgolly.scalajs.react.test.emissions.RenderWithReuseBy$", { + Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$: 1, + O: 1 +}); +export { $d_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$ }; +$c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$.prototype.$classData = $d_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$; +var $n_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$; + +function $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$() { + if (!$n_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$) { + $n_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$ = new $c_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$(); + } + + ; + return $n_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$; +} + +export { $m_Ljapgolly_scalajs_react_test_emissions_RenderWithReuseBy$ }; diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala index 7d05a6eee..c16447240 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala @@ -14,8 +14,6 @@ object ReactRefreshTest extends TestSuite { override def tests = Tests { - "version" - validateReactRefreshVersion() - "js" - { "fn" - testJs() "hooks" - testJs() @@ -33,12 +31,17 @@ object ReactRefreshTest extends TestSuite { "HooksWithScalaFns" - testScala() "JustPropsChildrenViaHookApi" - testScala(assertRR = false) // TODO: "JustPropsViaHookApi" - testScala(assertRR = false) // TODO: + "RenderReusable" - testScala(expectedInstalls = 6) + "RenderWithReuse" - testScala(expectedInstalls = 6) + "RenderWithReuseBy" - testScala(expectedInstalls = 6) "UseCallback" - testScala() "UseEffect" - testScala() "UseMemo" - testScala() "UseRef" - testScala() "UseStateWithReuse" - testScala() } + + "version" - validateReactRefreshVersion() } // =================================================================================================================== @@ -112,6 +115,7 @@ object ReactRefreshTest extends TestSuite { hack : TestJs.Hack = null, onCmp : TestJs.Hack = TestJs.Hack.forComparison, onShow : TestJs.Hack = TestJs.Hack.humanReadable, + expectedInstalls : Int = 1, expectedFrags : Seq[String] = Seq.empty) (implicit tp : TestPath) = testScala( @@ -124,6 +128,7 @@ object ReactRefreshTest extends TestSuite { hack = hack, onCmp = onCmp, onShow = onShow, + expectedInstalls = expectedInstalls, expectedFrags = expectedFrags, ) @@ -137,6 +142,7 @@ object ReactRefreshTest extends TestSuite { hack : TestJs.Hack = null, onCmp : TestJs.Hack = TestJs.Hack.forComparison, onShow : TestJs.Hack = TestJs.Hack.humanReadable, + expectedInstalls : Int = 1, expectedFrags : Seq[String] = Seq.empty) (implicit tp : TestPath) = { preTest() @@ -174,7 +180,7 @@ object ReactRefreshTest extends TestSuite { babel.assertChanged() if (assertRR) - babel.assertRR(true) + babel.assertRR(true, expectedInstalls) if (assertRR == false) babel.assertRR(false) diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Babel.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Babel.scala index 4f68881a4..f282b4e75 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Babel.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Babel.scala @@ -13,7 +13,7 @@ final case class Babel(before : String, fail("React Refresh Babel plugin didn't make any changes") } - def assertRR(expectInstalled: Boolean = true)(implicit l: Line): Unit = { + def assertRR(expectInstalled: Boolean = true, expectedInstallations: Int = 1)(implicit l: Line): Unit = { // Presense locally { @@ -27,7 +27,7 @@ final case class Babel(before : String, // Count installations locally { val actual = Util.countRR(after) - val expect = if (expectInstalled) 1 else 0 + val expect = if (expectInstalled) expectedInstallations else 0 if (actual !=* expect) { showBadOutput() assertEq("RR installations", actual, expect) diff --git a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala index 0f0791640..148ced008 100644 --- a/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala +++ b/library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/TestJs.scala @@ -81,20 +81,23 @@ object TestJs { .replace("PropsChildren$", "PropsChildren") - .replace( - "$j_java_lang_Character$.$m_s_reflect_ManifestFactory$IntManifest$()", - "$j_scala_reflect_ManifestFactory$IntManifest$.$m_s_reflect_ManifestFactory$IntManifest$()") - - .replace( - "$j_sjr_hooks_Api$Primary.$m_Lsjr_hooks_CustomHook$()", - "$j_sjr_hooks_CustomHook$.$m_Lsjr_hooks_CustomHook$()") - // Scala 3 only for some reason .replace("$FirstStep.$", "$First.$") - // From: $j_sjr_hooks_HookCtx$P3.$ct_Lsjr_hooks_HookCtx$P3__O__O__O__O__(new $j_sjr_hooks_HookCtx$P3.$c_Lsjr_hooks_HookCtx$P3(), props$0, hook1, hook2, hook3); - // To: new $j_sjr_hooks_HookCtx$P3.$c_Lsjr_hooks_HookCtx$P3(props$0, hook1, hook2, hook3) - .replaceAll("""\$j_[a-zA-Z_]+?\$P\d+?\.\$[a-zA-Z_]+?\$P[0-9_O]+?\((new [a-zA-Z0-9$_.]+\()\), """, "$1") + // idk if it's a Scala.js bug/undefined-behaviour or what, but there are often strange differences like the + // following for the same source code: + // + // $j_java_lang_Character$.$m_s_reflect_ManifestFactory$IntManifest$() + // $j_scala_reflect_ManifestFactory$IntManifest$.$m_s_reflect_ManifestFactory$IntManifest$() + // + // $j_sjr_Reusability.$m_Lsjr_Reusable$() + // $j_sjr_Reusable$.$m_Lsjr_Reusable$() + // + // etc + .replaceAll( + """\$j_[a-zA-Z_$]+\.(\$[mfp]_)""", + "$1" + ) ) ) diff --git a/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksRRTest.scala b/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksRRTest.scala index b51831202..08b72f7d3 100644 --- a/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksRRTest.scala +++ b/library/tests/src/test/scala/japgolly/scalajs/react/core/HooksRRTest.scala @@ -7,11 +7,13 @@ import japgolly.scalajs.react.test.DomTester import japgolly.scalajs.react.test.ReactTestUtils._ import japgolly.scalajs.react.test.TestUtil._ import japgolly.scalajs.react.vdom.html_<^._ +import scala.annotation._ import scala.scalajs.js import org.scalajs.dom.Node import org.scalajs.dom.html.Input import utest._ + // Based off of HooksTest but // - uses renderRR // - includes compilation tests for trivial useRef hooks missing from HooksTest @@ -1409,6 +1411,7 @@ object HooksRRTest extends TestSuite { private trait JsS extends js.Object private trait JsF extends js.Object + @nowarn("msg=pure.expression") private def testUseRefCompilation(): Unit = { val jsComp = JsComponent.force[Null, Children.None, Null](null) @@ -1433,6 +1436,202 @@ object HooksRRTest extends TestSuite { } } + private def testRenderWithReuseBy(): Unit = { + implicit val reusability: Reusability[PI] = Reusability.by[PI, Int](_.pi >> 1) + var renders = 0 + var extState = 5 + val comp = ScalaFnComponent.withHooks[PI] + .useState(20) + .useCallback(Callback(extState += 1)) + .useForceUpdate + .renderRRWithReuseBy((_, _, _, _)) { case (p, s, incES, fu) => + renders += 1 + <.div( + s"P=$p, S=${s.value}, ES=$extState, R=$renders", + <.button(^.onClick --> s.modState(_ + 1)), + <.button(^.onClick --> (incES >> fu)), + ) + } + + val wrapper = ScalaComponent.builder[PI].render_P(comp(_)).build + + withRenderedIntoBody(wrapper(PI(3))) { (m, root) => + val t = new DomTester(root) + t.assertText("P=PI(3), S=20, ES=5, R=1") + replaceProps(wrapper, m)(PI(2)); t.assertText("P=PI(3), S=20, ES=5, R=1") + t.clickButton(1); t.assertText("P=PI(2), S=21, ES=5, R=2") + replaceProps(wrapper, m)(PI(2)); t.assertText("P=PI(2), S=21, ES=5, R=2") + replaceProps(wrapper, m)(PI(3)); t.assertText("P=PI(2), S=21, ES=5, R=2") + replaceProps(wrapper, m)(PI(4)); t.assertText("P=PI(4), S=21, ES=5, R=3") + t.clickButton(2); t.assertText("P=PI(4), S=21, ES=6, R=4") + replaceProps(wrapper, m)(PI(5)); t.assertText("P=PI(4), S=21, ES=6, R=4") + } + } + + // See https://github.com/japgolly/scalajs-react/issues/1027 + private def testRenderWithReuseByNever(): Unit = { + implicit val reusability: Reusability[PI] = Reusability.never + var renders = 0 + val comp = ScalaFnComponent.withHooks[PI] + .renderRRWithReuseBy(ctx => ctx) { p => + renders += 1 + <.div(s"P=$p, R=$renders") + } + + val wrapper = ScalaComponent.builder[PI] + .initialStateFromProps(identity) + .renderS { ($, s) => + <.div( + comp(s), + <.button(^.onClick --> $.modState(_ + 0)), + <.button(^.onClick --> $.modState(_ + 1)), + ) + } + .build + + withRenderedIntoBody(wrapper(PI(3))) { (_, root) => + val t = new DomTester(root) + t.assertText("P=PI(3), R=1") + t.clickButton(2); t.assertText("P=PI(4), R=2") + t.clickButton(1); t.assertText("P=PI(4), R=3") + } + } + + private def testRenderWithReuseByNeverPC(): Unit = { + implicit val reusability: Reusability[PI] = Reusability.never + + implicit val v: Reusability[japgolly.scalajs.react.hooks.HookCtx.PC0[PI]] = + japgolly.scalajs.react.hooks.HookCtx.reusabilityPC0 + + var renders = 0 + val comp = ScalaFnComponent.withHooks[PI] + .withPropsChildren + .renderRRWithReuseBy((_, _)) { case (p, c) => + renders += 1 + <.div(s"P=$p, R=$renders", c) + } + + val wrapper = ScalaComponent.builder[PI] + .initialStateFromProps(identity) + .renderS { ($, s) => + <.div( + comp(s)("."), + <.button(^.onClick --> $.modState(_ + 0)), + <.button(^.onClick --> $.modState(_ + 1)), + ) + } + .build + + withRenderedIntoBody(wrapper(PI(3))) { (_, root) => + val t = new DomTester(root) + t.assertText("P=PI(3), R=1.") + t.clickButton(2); t.assertText("P=PI(4), R=2.") + t.clickButton(1); t.assertText("P=PI(4), R=3.") + } + } + + private def testRenderWithReuseByAndUseRef(): Unit = { + val comp = ScalaFnComponent.withHooks[Unit] + .useRef(100) + .useState(0) + .renderRRWithReuseBy(ctx => ctx) { $ => + val ref = $.hook1 + val s = $.hook2 + <.div( + ref.value, + <.button(^.onClick --> ref.mod(_ + 1)), + <.button(^.onClick --> s.modState(_ + 1)), + ) + } + + test(comp()) { t => + t.assertText("100") + t.clickButton(1); t.assertText("100") + t.clickButton(2); t.assertText("101") + t.clickButton(1); t.assertText("101") + t.clickButton(2); t.assertText("102") + } + } + + private def testRenderWithReuseByAndUseRefToVdom(): Unit = { + var text = "uninitialised" + val comp = ScalaFnComponent.withHooks[Unit] + .withPropsChildren + .useRefToVdom[Input] + .useState("x") + .renderRRWithReuseBy((_, _, _, _)) { case (_, c, inputRef, s) => + + def onChange(e: ReactEventFromInput): Callback = + s.setState(e.target.value) + + def btn: Callback = + for { + i <- inputRef.get.asCBO + // _ <- Callback.log(s"i.value = [${i.value}]") + } yield { + text = i.value + } + + <.div( + <.input.text.withRef(inputRef)(^.value := s.value, ^.onChange ==> onChange), + <.button(^.onClick --> btn), + c + ) + } + + test(comp("!")) { t => + t.assertInputText("x") + t.clickButton() + assertEq(text, "x") + + t.setInputText("hehe") + t.assertInputText("hehe") + t.clickButton() + assertEq(text, "hehe") + } + } + + private def testRenderWithReuseByAndUseRefToVdomO(): Unit = { + var text = "uninitialised" + val comp = ScalaFnComponent.withHooks[Unit] + .withPropsChildren + .useRefToVdom[Input] + .useState("x") + .renderRRWithReuseBy(ctx => ctx) { $ => + val c = $.propsChildren + val inputRef = $.hook1 + val s = $.hook2 + + def onChange(e: ReactEventFromInput): Callback = + s.setState(e.target.value) + + def btn: Callback = + for { + i <- inputRef.get.asCBO + // _ <- Callback.log(s"i.value = [${i.value}]") + } yield { + text = i.value + } + + <.div( + <.input.text.withRef(inputRef)(^.value := s.value, ^.onChange ==> onChange), + <.button(^.onClick --> btn), + c + ) + } + + test(comp("!")) { t => + t.assertInputText("x") + t.clickButton() + assertEq(text, "x") + + t.setInputText("hehe") + t.assertInputText("hehe") + t.clickButton() + assertEq(text, "hehe") + } + } + // =================================================================================================================== override def tests = Tests { @@ -1516,5 +1715,14 @@ object HooksRRTest extends TestSuite { "useRefToVdom" - testRenderWithReuseAndUseRefToVdom() // PC, Secondary, CtxFn "useRefToVdomO" - testRenderWithReuseAndUseRefToVdomO() // PC, Secondary, CtxObj } + + "renderWithReuseBy" - { + "main" - testRenderWithReuseBy() // P, Secondary, CtxFn + "never" - testRenderWithReuseByNever() // P, Primary + "neverC" - testRenderWithReuseByNeverPC() // PC, Primary + "useRef" - testRenderWithReuseByAndUseRef() // P, Secondary, CtxObj + "useRefToVdom" - testRenderWithReuseByAndUseRefToVdom() // PC, Secondary, CtxFn + "useRefToVdomO" - testRenderWithReuseByAndUseRefToVdomO() // PC, Secondary, CtxObj + } } }