Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support scalajs-react 2.0.0 (also for scala 3) #326

Merged
merged 2 commits into from
Dec 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ jobs:
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "build.sbt" }}
- v2-dependencies-{{ checksum "build.sbt" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- v2-dependencies-

- run: cat /dev/null | sbt test scalafmtCheck

Expand All @@ -51,4 +51,4 @@ jobs:
- ~/.ivy2/cache
- ~/.ivy2/local
- ~/.cache/scalablytyped/tests/artifacts
key: v1-dependencies--{{ checksum "build.sbt" }}
key: v2-dependencies--{{ checksum "build.sbt" }}
2 changes: 1 addition & 1 deletion docs/flavour.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ project.settings(
// for Slinky native projects
stFlavour := Flavour.SlinkyNative,
// for scalajs-react projects
stFlavour := Flavour.Japgolly
stFlavour := Flavour.ScalajsReact
)
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ case class ConversionOptions(
SlinkyFlavour(outputPackage, enableLongApplyMethod, versions, enableReactTreeShaking)
case Flavour.SlinkyNative =>
SlinkyNativeFlavour(outputPackage, enableLongApplyMethod, versions, enableReactTreeShaking)
case Flavour.Japgolly =>
case Flavour.ScalajsReact =>
JapgollyFlavour(outputPackage, enableLongApplyMethod, versions, enableReactTreeShaking)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ object Ci {
)
else if (flags.contains("-flavourJapgolly"))
(
Flavour.Japgolly,
Flavour.ScalajsReact,
Name("typingsJapgolly"),
ProjectName("ScalajsReactTyped"),
new URI("https://github.com/ScalablyTyped/ScalajsReactTyped.git"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ object Flavour {
case object Normal extends Flavour("normal")
case object Slinky extends Flavour("slinky")
case object SlinkyNative extends Flavour("slinky-native")
case object Japgolly extends Flavour("japgolly")
case object ScalajsReact extends Flavour("scalajs-react")

@deprecated("Use Flavour.ScalajsReact")
val Japgolly = ScalajsReact

val All: List[Flavour] =
List(Normal, Slinky, SlinkyNative, Japgolly)
List(Normal, Slinky, SlinkyNative, ScalajsReact)

val byName: Map[String, Flavour] =
All.map(f => f.id -> f).toMap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,5 @@ case class Versions(scala: Versions.Scala, scalaJs: Versions.ScalaJs) {
val scalaJsDom = Dep.ScalaJs("org.scala-js", "scalajs-dom", "2.0.0")
val slinkyWeb = Dep.ScalaJs("me.shadaj", "slinky-web", "0.6.8+1-b1dd3f4c").for3Use2_13(scala.is3)
val slinkyNative = Dep.ScalaJs("me.shadaj", "slinky-native", "0.6.8+1-b1dd3f4c").for3Use2_13(scala.is3)
val scalajsReact = Dep.ScalaJs("com.github.japgolly.scalajs-react", "core", "1.7.5").for3Use2_13(scala.is3)
val scalajsReact = Dep.ScalaJs("com.github.japgolly.scalajs-react", "core", "2.0.0")
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ object JapgollyNames {
val Array = QualifiedName("japgolly.scalajs.react.vdom.VdomArray")
val VdomNode = QualifiedName("japgolly.scalajs.react.vdom.VdomNode")
}

object rawReact {
val Element = QualifiedName("japgolly.scalajs.react.raw.React.Element")
val Node = QualifiedName("japgolly.scalajs.react.raw.React.Node")
val RefFn = QualifiedName("japgolly.scalajs.react.raw.React.RefFn")
val RefHandle = QualifiedName("japgolly.scalajs.react.raw.React.RefHandle")
val Component = QualifiedName("japgolly.scalajs.react.raw.React.Component")
val ComponentClassP = QualifiedName("japgolly.scalajs.react.raw.React.ComponentClassP")
val DomElement = QualifiedName("japgolly.scalajs.react.raw.React.DomElement")
val ElementType = QualifiedName("japgolly.scalajs.react.raw.React.ElementType")
val Element = QualifiedName("japgolly.scalajs.react.facade.React.Element")
val Node = QualifiedName("japgolly.scalajs.react.facade.React.Node")
val RefFn = QualifiedName("japgolly.scalajs.react.facade.React.RefFn")
val RefHandle = QualifiedName("japgolly.scalajs.react.facade.React.RefHandle")
val Component = QualifiedName("japgolly.scalajs.react.facade.React.Component")
val ComponentClassP = QualifiedName("japgolly.scalajs.react.facade.React.ComponentClassP")
val DomElement = QualifiedName("japgolly.scalajs.react.facade.React.DomElement")
val ElementType = QualifiedName("japgolly.scalajs.react.facade.React.ElementType")
}
}
8 changes: 4 additions & 4 deletions tests/material-ui/check-japgolly-3/m/material-ui/build.sbt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
organization := "org.scalablytyped"
name := "material-ui"
version := "0.0-unknown-d92b16"
version := "0.0-unknown-49dc92"
scalaVersion := "3.1.0"
enablePlugins(ScalaJSPlugin)
libraryDependencies ++= Seq(
"com.github.japgolly.scalajs-react" %%% "core" % "2.0.0",
"com.olvind" %%% "scalablytyped-runtime" % "2.4.2",
"org.scalablytyped" %%% "react" % "0.0-unknown-b0e5ab",
"org.scalablytyped" %%% "std" % "0.0-unknown-8533be",
("com.github.japgolly.scalajs-react" %%% "core" % "1.7.5").cross(CrossVersion.for3Use2_13))
"org.scalablytyped" %%% "react" % "0.0-unknown-9cdef8",
"org.scalablytyped" %%% "std" % "0.0-unknown-e41d98")
publishArtifact in packageDoc := false
scalacOptions ++= List("-encoding", "utf-8", "-feature", "-language:implicitConversions", "-language:higherKinds", "-language:existentials", "-no-indent", "-source:future")
licenses += ("MIT", url("http://opensource.org/licenses/MIT"))
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package mylib.internal.baz.materialUi

import japgolly.scalajs.react.raw.React.Component
import japgolly.scalajs.react.facade.React.Component
import org.scalablytyped.runtime.StObject
import scala.scalajs.js
import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess}
Expand Down
6 changes: 3 additions & 3 deletions tests/material-ui/check-japgolly-3/r/react/build.sbt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
organization := "org.scalablytyped"
name := "react"
version := "0.0-unknown-b0e5ab"
version := "0.0-unknown-9cdef8"
scalaVersion := "3.1.0"
enablePlugins(ScalaJSPlugin)
libraryDependencies ++= Seq(
"com.github.japgolly.scalajs-react" %%% "core" % "2.0.0",
"com.olvind" %%% "scalablytyped-runtime" % "2.4.2",
"org.scalablytyped" %%% "std" % "0.0-unknown-8533be",
("com.github.japgolly.scalajs-react" %%% "core" % "1.7.5").cross(CrossVersion.for3Use2_13))
"org.scalablytyped" %%% "std" % "0.0-unknown-e41d98")
publishArtifact in packageDoc := false
scalacOptions ++= List("-encoding", "utf-8", "-feature", "-language:implicitConversions", "-language:higherKinds", "-language:existentials", "-no-indent", "-source:future")
licenses += ("MIT", url("http://opensource.org/licenses/MIT"))
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package mylib.internal.baz
import mylib.internal.baz.StBuildingComponent.make
import japgolly.scalajs.react.Key
import japgolly.scalajs.react.Ref.Simple
import japgolly.scalajs.react.raw.React.Element
import japgolly.scalajs.react.raw.React.Node
import japgolly.scalajs.react.facade.React.Element
import japgolly.scalajs.react.facade.React.Node
import japgolly.scalajs.react.vdom.TagMod
import japgolly.scalajs.react.vdom.TagMod.Composite
import japgolly.scalajs.react.vdom.VdomElement
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package mylib.internal.baz.react

import japgolly.scalajs.react.raw.Empty
import japgolly.scalajs.react.raw.JsNumber
import japgolly.scalajs.react.raw.React.Element
import japgolly.scalajs.react.raw.React.Node
import japgolly.scalajs.react.facade.Empty
import japgolly.scalajs.react.facade.JsNumber
import japgolly.scalajs.react.facade.React.Element
import japgolly.scalajs.react.facade.React.Node
import japgolly.scalajs.react.vdom.VdomElement
import japgolly.scalajs.react.vdom.VdomNode
import org.scalablytyped.runtime.StObject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import mylib.internal.baz.react.anon.Html
import mylib.internal.baz.react.reactStrings.foo
import mylib.internal.baz.std.Partial
import japgolly.scalajs.react.Callback
import japgolly.scalajs.react.raw.Empty
import japgolly.scalajs.react.raw.JsNumber
import japgolly.scalajs.react.raw.React.ComponentClassP
import japgolly.scalajs.react.raw.React.Element
import japgolly.scalajs.react.raw.React.Node
import japgolly.scalajs.react.facade.Empty
import japgolly.scalajs.react.facade.JsNumber
import japgolly.scalajs.react.facade.React.ComponentClassP
import japgolly.scalajs.react.facade.React.Element
import japgolly.scalajs.react.facade.React.Node
import japgolly.scalajs.react.vdom.VdomElement
import japgolly.scalajs.react.vdom.VdomNode
import org.scalablytyped.runtime.Instantiable1
Expand Down Expand Up @@ -54,12 +54,12 @@ private[internal] object mod {
extends StObject
with Instantiable1[
/* props */ P,
japgolly.scalajs.react.raw.React.Component[P & js.Object, js.Object]
japgolly.scalajs.react.facade.React.Component[P & js.Object, js.Object]
]
with Instantiable2[
/* props */ P,
/* context */ js.Any,
japgolly.scalajs.react.raw.React.Component[P & js.Object, js.Object]
japgolly.scalajs.react.facade.React.Component[P & js.Object, js.Object]
] {

var defaultProps: js.UndefOr[Partial[P]] = js.native
Expand Down
6 changes: 3 additions & 3 deletions tests/material-ui/check-japgolly-3/s/std/build.sbt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
organization := "org.scalablytyped"
name := "std"
version := "0.0-unknown-8533be"
version := "0.0-unknown-e41d98"
scalaVersion := "3.1.0"
enablePlugins(ScalaJSPlugin)
libraryDependencies ++= Seq(
"com.olvind" %%% "scalablytyped-runtime" % "2.4.2",
("com.github.japgolly.scalajs-react" %%% "core" % "1.7.5").cross(CrossVersion.for3Use2_13))
"com.github.japgolly.scalajs-react" %%% "core" % "2.0.0",
"com.olvind" %%% "scalablytyped-runtime" % "2.4.2")
publishArtifact in packageDoc := false
scalacOptions ++= List("-encoding", "utf-8", "-feature", "-language:implicitConversions", "-language:higherKinds", "-language:existentials", "-no-indent", "-source:future")
licenses += ("MIT", url("http://opensource.org/licenses/MIT"))
Original file line number Diff line number Diff line change
Expand Up @@ -6,49 +6,49 @@ import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, J

private[internal] trait HTMLElementTagNameMap extends StObject {

var a: org.scalajs.dom.raw.HTMLAnchorElement
var a: org.scalajs.dom.HTMLAnchorElement

var abbr: org.scalajs.dom.raw.HTMLElement
var abbr: org.scalajs.dom.HTMLElement

var address: org.scalajs.dom.raw.HTMLElement
var address: org.scalajs.dom.HTMLElement

var area: org.scalajs.dom.raw.HTMLAreaElement
var area: org.scalajs.dom.HTMLAreaElement

var article: org.scalajs.dom.raw.HTMLElement
var article: org.scalajs.dom.HTMLElement

var aside: org.scalajs.dom.raw.HTMLElement
var aside: org.scalajs.dom.HTMLElement

var audio: org.scalajs.dom.raw.HTMLAudioElement
var audio: org.scalajs.dom.HTMLAudioElement
}
private[internal] object HTMLElementTagNameMap {

inline def apply(
a: org.scalajs.dom.raw.HTMLAnchorElement,
abbr: org.scalajs.dom.raw.HTMLElement,
address: org.scalajs.dom.raw.HTMLElement,
area: org.scalajs.dom.raw.HTMLAreaElement,
article: org.scalajs.dom.raw.HTMLElement,
aside: org.scalajs.dom.raw.HTMLElement,
audio: org.scalajs.dom.raw.HTMLAudioElement
a: org.scalajs.dom.HTMLAnchorElement,
abbr: org.scalajs.dom.HTMLElement,
address: org.scalajs.dom.HTMLElement,
area: org.scalajs.dom.HTMLAreaElement,
article: org.scalajs.dom.HTMLElement,
aside: org.scalajs.dom.HTMLElement,
audio: org.scalajs.dom.HTMLAudioElement
): HTMLElementTagNameMap = {
val __obj = js.Dynamic.literal(a = a.asInstanceOf[js.Any], abbr = abbr.asInstanceOf[js.Any], address = address.asInstanceOf[js.Any], area = area.asInstanceOf[js.Any], article = article.asInstanceOf[js.Any], aside = aside.asInstanceOf[js.Any], audio = audio.asInstanceOf[js.Any])
__obj.asInstanceOf[HTMLElementTagNameMap]
}

extension [Self <: HTMLElementTagNameMap](x: Self) {

inline def setA(value: org.scalajs.dom.raw.HTMLAnchorElement): Self = StObject.set(x, "a", value.asInstanceOf[js.Any])
inline def setA(value: org.scalajs.dom.HTMLAnchorElement): Self = StObject.set(x, "a", value.asInstanceOf[js.Any])

inline def setAbbr(value: org.scalajs.dom.raw.HTMLElement): Self = StObject.set(x, "abbr", value.asInstanceOf[js.Any])
inline def setAbbr(value: org.scalajs.dom.HTMLElement): Self = StObject.set(x, "abbr", value.asInstanceOf[js.Any])

inline def setAddress(value: org.scalajs.dom.raw.HTMLElement): Self = StObject.set(x, "address", value.asInstanceOf[js.Any])
inline def setAddress(value: org.scalajs.dom.HTMLElement): Self = StObject.set(x, "address", value.asInstanceOf[js.Any])

inline def setArea(value: org.scalajs.dom.raw.HTMLAreaElement): Self = StObject.set(x, "area", value.asInstanceOf[js.Any])
inline def setArea(value: org.scalajs.dom.HTMLAreaElement): Self = StObject.set(x, "area", value.asInstanceOf[js.Any])

inline def setArticle(value: org.scalajs.dom.raw.HTMLElement): Self = StObject.set(x, "article", value.asInstanceOf[js.Any])
inline def setArticle(value: org.scalajs.dom.HTMLElement): Self = StObject.set(x, "article", value.asInstanceOf[js.Any])

inline def setAside(value: org.scalajs.dom.raw.HTMLElement): Self = StObject.set(x, "aside", value.asInstanceOf[js.Any])
inline def setAside(value: org.scalajs.dom.HTMLElement): Self = StObject.set(x, "aside", value.asInstanceOf[js.Any])

inline def setAudio(value: org.scalajs.dom.raw.HTMLAudioElement): Self = StObject.set(x, "audio", value.asInstanceOf[js.Any])
inline def setAudio(value: org.scalajs.dom.HTMLAudioElement): Self = StObject.set(x, "audio", value.asInstanceOf[js.Any])
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, J

private[internal] trait SVGElementTagNameMap extends StObject {

var circle: org.scalajs.dom.raw.SVGCircleElement
var circle: org.scalajs.dom.SVGCircleElement
}
private[internal] object SVGElementTagNameMap {

inline def apply(circle: org.scalajs.dom.raw.SVGCircleElement): SVGElementTagNameMap = {
inline def apply(circle: org.scalajs.dom.SVGCircleElement): SVGElementTagNameMap = {
val __obj = js.Dynamic.literal(circle = circle.asInstanceOf[js.Any])
__obj.asInstanceOf[SVGElementTagNameMap]
}

extension [Self <: SVGElementTagNameMap](x: Self) {

inline def setCircle(value: org.scalajs.dom.raw.SVGCircleElement): Self = StObject.set(x, "circle", value.asInstanceOf[js.Any])
inline def setCircle(value: org.scalajs.dom.SVGCircleElement): Self = StObject.set(x, "circle", value.asInstanceOf[js.Any])
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import scala.scalajs.js
import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess}


private[internal] type Element = org.scalajs.dom.raw.Node
private[internal] type Element = org.scalajs.dom.Node

private[internal] type HTMLAnchorElement = org.scalajs.dom.raw.Element
private[internal] type HTMLAnchorElement = org.scalajs.dom.Element

private[internal] type HTMLAreaElement = org.scalajs.dom.raw.Element
private[internal] type HTMLAreaElement = org.scalajs.dom.Element

private[internal] type HTMLAudioElement = org.scalajs.dom.raw.Element
private[internal] type HTMLAudioElement = org.scalajs.dom.Element

private[internal] type HTMLElement = org.scalajs.dom.raw.Element
private[internal] type HTMLElement = org.scalajs.dom.Element

private[internal] type Partial[T] = T

private[internal] type SVGCircleElement = org.scalajs.dom.raw.Element
private[internal] type SVGCircleElement = org.scalajs.dom.Element
13 changes: 13 additions & 0 deletions tests/material-ui/check-japgolly/m/material-ui/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
organization := "org.scalablytyped"
name := "material-ui"
version := "0.0-unknown-f24ba3"
scalaVersion := "3.0.1"
enablePlugins(ScalaJSPlugin)
libraryDependencies ++= Seq(
"com.github.japgolly.scalajs-react" %%% "core" % "2.0.0-RC1",
"com.olvind" %%% "scalablytyped-runtime" % "2.4.2",
"org.scalablytyped" %%% "react" % "0.0-unknown-a6bd68",
"org.scalablytyped" %%% "std" % "0.0-unknown-7bde64")
publishArtifact in packageDoc := false
scalacOptions ++= List("-encoding", "utf-8", "-feature", "-language:implicitConversions", "-language:higherKinds", "-language:existentials", "-no-indent")
licenses += ("MIT", url("http://opensource.org/licenses/MIT"))
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package mylib.internal.baz.materialUi

import japgolly.scalajs.react.raw.React.Component
import japgolly.scalajs.react.facade.React.Component
import org.scalablytyped.runtime.StObject
import scala.scalajs.js
import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package mylib.internal.baz
import mylib.internal.baz.StBuildingComponent.make
import japgolly.scalajs.react.Key
import japgolly.scalajs.react.Ref.Simple
import japgolly.scalajs.react.raw.React.Element
import japgolly.scalajs.react.raw.React.Node
import japgolly.scalajs.react.facade.React.Element
import japgolly.scalajs.react.facade.React.Node
import japgolly.scalajs.react.vdom.TagMod
import japgolly.scalajs.react.vdom.TagMod.Composite
import japgolly.scalajs.react.vdom.VdomElement
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package mylib.internal.baz.react

import japgolly.scalajs.react.raw.Empty
import japgolly.scalajs.react.raw.JsNumber
import japgolly.scalajs.react.raw.React.Element
import japgolly.scalajs.react.raw.React.Node
import japgolly.scalajs.react.facade.Empty
import japgolly.scalajs.react.facade.JsNumber
import japgolly.scalajs.react.facade.React.Element
import japgolly.scalajs.react.facade.React.Node
import japgolly.scalajs.react.vdom.VdomElement
import japgolly.scalajs.react.vdom.VdomNode
import org.scalablytyped.runtime.StObject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import mylib.internal.baz.react.anon.Html
import mylib.internal.baz.react.reactStrings.foo
import mylib.internal.baz.std.Partial
import japgolly.scalajs.react.Callback
import japgolly.scalajs.react.raw.Empty
import japgolly.scalajs.react.raw.JsNumber
import japgolly.scalajs.react.raw.React.ComponentClassP
import japgolly.scalajs.react.raw.React.Element
import japgolly.scalajs.react.raw.React.Node
import japgolly.scalajs.react.facade.Empty
import japgolly.scalajs.react.facade.JsNumber
import japgolly.scalajs.react.facade.React.ComponentClassP
import japgolly.scalajs.react.facade.React.Element
import japgolly.scalajs.react.facade.React.Node
import japgolly.scalajs.react.vdom.VdomElement
import japgolly.scalajs.react.vdom.VdomNode
import org.scalablytyped.runtime.Instantiable1
Expand Down Expand Up @@ -54,12 +54,12 @@ private[internal] object mod {
extends StObject
with Instantiable1[
/* props */ P,
japgolly.scalajs.react.raw.React.Component[P & js.Object, js.Object]
japgolly.scalajs.react.facade.React.Component[P & js.Object, js.Object]
]
with Instantiable2[
/* props */ P,
/* context */ js.Any,
japgolly.scalajs.react.raw.React.Component[P & js.Object, js.Object]
japgolly.scalajs.react.facade.React.Component[P & js.Object, js.Object]
] {

var defaultProps: js.UndefOr[Partial[P]] = js.native
Expand Down
Loading