Skip to content

Commit be97347

Browse files
committed
Merge branch 'master' into cb-io
2 parents 8421d36 + 5e473f1 commit be97347

File tree

44 files changed

+812
-263
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+812
-263
lines changed

.github/dependabot.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: 2
2+
updates:
3+
4+
- package-ecosystem: github-actions
5+
directory: "/"
6+
schedule:
7+
interval: daily
8+
open-pull-requests-limit: 10
9+

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
uses: actions/checkout@v2
2222

2323
- name: Setup Scala
24-
uses: japgolly/setup-everything-scala@v1.0
24+
uses: japgolly/setup-everything-scala@v2.0
2525
with:
2626
java-version: adopt@1.${{ matrix.java }}
2727

bin/ci

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ cmd=(
4545
++$SCALA_VER
4646
'set ThisBuild / parallelExecution := false'
4747
'set Global / concurrentRestrictions += Tags.limit(ScalaJSTags.Link, 1)'
48+
clean
4849
test # Test development-mode
4950
'set ThisBuild / scalaJSStage := FullOptStage' test # Test production-mode
5051
publishLocal # For downstream tests

build.sbt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
ThisBuild / organization := "com.github.japgolly.scalajs-react"
2-
ThisBuild / homepage := Some(url("https://github.com/japgolly/scalajs-react"))
3-
ThisBuild / licenses := ("Apache-2.0", url("http://opensource.org/licenses/Apache-2.0")) :: Nil
4-
ThisBuild / shellPrompt := ((s: State) => Project.extract(s).currentRef.project + "> ")
5-
sonatypeProfileName := "com.github.japgolly"
1+
ThisBuild / organization := "com.github.japgolly.scalajs-react"
2+
ThisBuild / homepage := Some(url("https://github.com/japgolly/scalajs-react"))
3+
ThisBuild / licenses := ("Apache-2.0", url("http://opensource.org/licenses/Apache-2.0")) :: Nil
4+
ThisBuild / shellPrompt := ((s: State) => Project.extract(s).currentRef.project + "> ")
5+
ThisBuild / versionScheme := Some("early-semver")
6+
sonatypeProfileName := "com.github.japgolly"
67

78
val callback = ScalaJsReact.callback
89
val callbackExtCats = ScalaJsReact.callbackExtCats
@@ -23,6 +24,7 @@ val ghpagesMacros = ScalaJsReact.ghpagesMacros
2324
val root = ScalaJsReact.root
2425
val scalafixRules = ScalaJsReact.scalafixRules
2526
val tests = ScalaJsReact.tests
27+
val testUtilMacros = ScalaJsReact.testUtilMacros
2628
val testUtil = ScalaJsReact.testUtil
2729
val util = ScalaJsReact.util
2830
val utilCatsEffect = ScalaJsReact.utilCatsEffect

callback/src/main/scala-2/japgolly/scalajs/react/callback/CallbackTo.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import japgolly.scalajs.react.util.Effect.Sync
55
import japgolly.scalajs.react.util.JsUtil
66
import japgolly.scalajs.react.util.Util.{catchAll, identityFn}
77
import java.time.{Duration, Instant}
8-
import org.scalajs.dom.raw.Window
9-
import org.scalajs.dom.window
8+
import org.scalajs.dom.{Window, window}
109
import scala.annotation.tailrec
1110
import scala.collection.BuildFrom
1211
import scala.concurrent.duration.{FiniteDuration, MILLISECONDS}

callback/src/main/scala-3/japgolly/scalajs/react/callback/CallbackTo.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import japgolly.scalajs.react.util.Effect.Sync
55
import japgolly.scalajs.react.util.JsUtil
66
import japgolly.scalajs.react.util.Util.{catchAll, identityFn}
77
import java.time.{Duration, Instant}
8-
import org.scalajs.dom.raw.Window
8+
import org.scalajs.dom.Window
99
import org.scalajs.dom.window
1010
import scala.annotation.tailrec
1111
import scala.collection.BuildFrom
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package japgolly.scalajs.react.internal
2+
3+
import japgolly.microlibs.compiletime._
4+
import scala.reflect.macros.blackbox.Context
5+
6+
abstract class ConfigMacros(val c: Context) extends MacroUtils {
7+
import c.universe._
8+
9+
protected def readConfig(key: String): Option[String] =
10+
(Option(System.getProperty(key, null)) orElse Option(System.getenv(key)))
11+
.map(_.trim.toLowerCase)
12+
.filter(_.nonEmpty)
13+
14+
protected def modStr(expr: c.Expr[String])(f: String => c.Expr[String]): c.Expr[String] =
15+
expr match {
16+
case Expr(Literal(Constant(s: String))) => f(s)
17+
case _ => expr
18+
}
19+
20+
protected implicit def lit(s: String): c.Expr[String] =
21+
c.Expr(Literal(Constant(s)))
22+
}

coreGeneric/src/main/scala-2/japgolly/scalajs/react/internal/ScalaJsReactConfigMacros.scala

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,16 @@
11
package japgolly.scalajs.react.internal
22

3-
import japgolly.microlibs.compiletime._
43
import scala.reflect.macros.blackbox.Context
54

65
object ScalaJsReactConfigMacros {
76
final val KeyCompNameAll = "japgolly.scalajs.react.component.names.all"
87
final val KeyCompNameAuto = "japgolly.scalajs.react.component.names.implicit"
98
}
109

11-
class ScalaJsReactConfigMacros(val c: Context) extends MacroUtils {
10+
class ScalaJsReactConfigMacros(override val c: Context) extends ConfigMacros(c) {
1211
import ScalaJsReactConfigMacros._
1312
import c.universe._
1413

15-
private def readConfig(key: String): Option[String] =
16-
(Option(System.getProperty(key, null)) orElse Option(System.getenv(key)))
17-
.map(_.trim.toLowerCase)
18-
.filter(_.nonEmpty)
19-
20-
private def modStr(expr: c.Expr[String])(f: String => c.Expr[String]): c.Expr[String] =
21-
expr match {
22-
case Expr(Literal(Constant(s: String))) => f(s)
23-
case _ =>
24-
// warn(s"Unable to transform component name:\n $expr\n ${showRaw(expr)}")
25-
expr
26-
}
27-
28-
private implicit def lit(s: String): c.Expr[String] =
29-
c.Expr(Literal(Constant(s)))
30-
3114
def automaticComponentName(displayName: c.Expr[String]): c.Expr[String] =
3215
modStr(displayName)(_automaticComponentName(_))
3316

coreGeneric/src/main/scala-2/japgolly/scalajs/react/vdom/Attr.scala

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,24 @@ object Attr {
6363
O.foreach(callback)(prepare(_)())
6464
}
6565

66-
trait EventCallback0 {
67-
implicit def dispatch[F[_]](implicit F: Dispatch[F]): EventCallback[F[Unit]] =
68-
new EventCallback(fa => F.dispatchFn(fa))
69-
66+
trait EventCallback1 {
7067
implicit def reusableDispatch[F[_]](implicit F: Dispatch[F]): EventCallback[Reusable[F[Unit]]] =
7168
new EventCallback(fa => F.dispatchFn(fa))
7269
}
7370

74-
object EventCallback extends EventCallback0 {
75-
import DefaultEffects.{Sync => D}
71+
trait EventCallback2 extends EventCallback1 {
72+
implicit def dispatch[F[_]](implicit F: Dispatch[F]): EventCallback[F[Unit]] =
73+
new EventCallback(fa => F.dispatchFn(fa))
74+
}
7675

77-
implicit val defaultSync: EventCallback[D[Unit]] =
78-
dispatch(D)
76+
trait EventCallback3 extends EventCallback2 {
77+
implicit lazy val reusableDefaultSync: EventCallback[Reusable[DefaultEffects.Sync[Unit]]] =
78+
reusableDispatch(DefaultEffects.Sync)
79+
}
7980

80-
implicit lazy val reusableDefaultSync: EventCallback[Reusable[D[Unit]]] =
81-
reusableDispatch(D)
81+
object EventCallback extends EventCallback3 {
82+
implicit val defaultSync: EventCallback[DefaultEffects.Sync[Unit]] =
83+
dispatch(DefaultEffects.Sync)
8284
}
8385

8486
type EventHandler[E[+x <: dom.Node] <: facade.SyntheticEvent[x]] =

coreGeneric/src/main/scala-3/japgolly/scalajs/react/vdom/Attr.scala

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,22 +79,24 @@ object Attr {
7979
O.foreach(callback)(prepare(_)())
8080
}
8181

82-
trait EventCallback0 {
83-
implicit def dispatch[F[_]](implicit F: Dispatch[F]): EventCallback[F[Unit]] =
84-
new EventCallback(fa => F.dispatchFn(fa))
85-
82+
trait EventCallback1 {
8683
implicit def reusableDispatch[F[_]](implicit F: Dispatch[F]): EventCallback[Reusable[F[Unit]]] =
8784
new EventCallback(fa => F.dispatchFn(fa))
8885
}
8986

90-
object EventCallback extends EventCallback0 {
91-
import DefaultEffects.{Sync => D}
87+
trait EventCallback2 extends EventCallback1 {
88+
implicit def dispatch[F[_]](implicit F: Dispatch[F]): EventCallback[F[Unit]] =
89+
new EventCallback(fa => F.dispatchFn(fa))
90+
}
9291

93-
implicit val defaultSync: EventCallback[D[Unit]] =
94-
dispatch(D)
92+
trait EventCallback3 extends EventCallback2 {
93+
implicit lazy val reusableDefaultSync: EventCallback[Reusable[DefaultEffects.Sync[Unit]]] =
94+
reusableDispatch(DefaultEffects.Sync)
95+
}
9596

96-
implicit lazy val reusableDefaultSync: EventCallback[Reusable[D[Unit]]] =
97-
reusableDispatch(D)
97+
object EventCallback extends EventCallback3 {
98+
implicit val defaultSync: EventCallback[DefaultEffects.Sync[Unit]] =
99+
dispatch(DefaultEffects.Sync)
98100
}
99101

100102
type EventHandler[E[+x <: dom.Node] <: facade.SyntheticEvent[x]] =

0 commit comments

Comments
 (0)