Skip to content

Commit 1e3510c

Browse files
committed
push it baby..
1 parent 331bca5 commit 1e3510c

40 files changed

+1412
-2517
lines changed

.travis.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,22 @@ install:
1212
- nvm install stable
1313
- nvm use stable
1414
- npm install
15-
- npm install jsdom source-map-support
15+
- npm install jsdom source-map-support jsdom-global
1616

1717
env:
1818
global:
1919
JSENV=node
2020

21-
#script:
22-
# - sbt ++$TRAVIS_SCALA_VERSION test:fastOptJS test:fullOptJS
23-
# - sbt ++$TRAVIS_SCALA_VERSION 'set parallelExecution in ThisBuild := false' test
24-
# - sbt ++$TRAVIS_SCALA_VERSION 'set parallelExecution in ThisBuild := false' 'set scalaJSStage in ThisBuild := FullOptStage' test
25-
# - bin/checkDevOnly $TRAVIS_SCALA_VERSION
21+
script:
22+
- sbt ++$TRAVIS_SCALA_VERSION test:fastOptJS test:fullOptJS
23+
- sbt ++$TRAVIS_SCALA_VERSION 'set parallelExecution in ThisBuild := false' test
24+
- sbt ++$TRAVIS_SCALA_VERSION 'set parallelExecution in ThisBuild := false' 'set scalaJSStage in ThisBuild := FullOptStage' test
2625

2726

2827
deploy:
2928
provider: script
3029
script:
31-
- /bin/bash "$TRAVIS_BUILD_DIR/.travis.credentials.sh" && sbt +publish
30+
- /bin/bash "$TRAVIS_BUILD_DIR/.travis.credentials.sh" && sbt ++$TRAVIS_SCALA_VERSION publish
3231
on:
3332
tags: true
3433

build.sbt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ val scala211 = "2.11.8"
88

99
val scala212 = "2.12.1"
1010

11-
scalaVersion := scala212
11+
scalaVersion := scala211
1212

1313
crossScalaVersions := Seq(scala211, scala212)
1414

@@ -39,7 +39,5 @@ publishArtifact in Test := false
3939
scalaJSModuleKind := ModuleKind.CommonJSModule
4040
resolvers += Resolver.bintrayRepo("scalajs-react-universe", "maven")
4141
libraryDependencies += "org.scalatest" %%% "scalatest" % "3.0.0" % Test
42-
libraryDependencies += "scalajs-react-universe" %%% "enzyme" % "2017.2.0-SNAPSHOT" % Test
43-
libraryDependencies += "scalajs-react-universe" %%% "macros" % "2017.2.0-SNAPSHOT" % Test
4442
//scalaJSStage in Global := FastOptStage
4543
scalaJSStage in Global := FullOptStage

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@
1111
"build": "webpack --watch"
1212
},
1313
"devDependencies": {
14+
"jsdom-global": "2.1.1",
1415
"webpack": "^1.9.10"
1516
},
1617
"dependencies": {
1718
"enzyme": "^2.7.0",
1819
"history": "^4.4.0",
1920
"jsdom": "^9.9.1",
20-
"react": "^15.3.2",
21-
"react-addons-test-utils": "^15.3.2",
22-
"react-dom": "^15.3.2"
21+
"react": "next",
22+
"react-addons-test-utils": "next",
23+
"react-dom": "next"
2324
}
2425
}

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
sbt.version=0.13.11
1+
sbt.version=0.13.13
22

project/plugins.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.15-SNAPSHOT")
1+
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.15")
22
addSbtPlugin("com.dwijnand" % "sbt-dynver" % "1.1.1")
33
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0")
44
addSbtPlugin("me.lessis" % "bintray-sbt" % "0.3.0")

src/main/scala/sri/core/CreateElement.scala

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,16 @@ import scala.scalajs.js.{ConstructorTag, |}
66
object CreateElement {
77

88
@inline
9-
def apply[C <: ReactScalaClass: ConstructorTag](
10-
props: C#Props#ScalaProps,
11-
key: String | Int = null,
12-
ref: C => Unit = null,
13-
children: js.Array[ReactNode] = emptyJSArray())
9+
def apply[C <: ReactScalaClass: ConstructorTag](props: C#ScalaPropsType,
10+
key: String | Int = null,
11+
ref: js.Function1[C, Unit] =
12+
null)
1413
: ReactElement { type Instance = C } = {
15-
CreateElementJS(
16-
js.constructorTag[C].constructor.asInstanceOf[C],
17-
js.Dynamic.literal(sprops = props.asInstanceOf[js.Any]),
14+
CreateElementJS[C](
15+
componentConstructor[C],
16+
JSProps(props),
1817
key = key,
19-
ref = ref,
20-
children
18+
ref = ref
2119
)
2220
}
2321

src/main/scala/sri/core/CreateElementJS.scala

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,21 @@ import scala.scalajs.{LinkingInfo, js}
44
import scala.scalajs.js.{ConstructorTag, |}
55

66
object CreateElementJS {
7-
87
@inline
9-
def apply[C <: ReactClass](ctor: C,
10-
props: js.Any,
11-
key: String | Int = null,
12-
ref: C => Unit = null,
13-
children: js.Array[ReactNode] = emptyJSArray())
8+
def apply[C <: ReactClass](ctor: ComponentConstructor {
9+
type ComponentType = C
10+
}, props: C#PropsType, key: String | Int = null, ref: js.Function1[C, Unit] = null, children: js.Array[ReactNode] = emptyJSArray())
1411
: ReactElement { type Instance = C } = {
1512

16-
if (LinkingInfo.developmentMode || ref != null) {
13+
if (LinkingInfo.developmentMode) {
1714
if (ref != null)
1815
props.asInstanceOf[js.Dynamic].updateDynamic("ref")(ref)
1916
if (key != null)
2017
props
2118
.asInstanceOf[js.Dynamic]
2219
.updateDynamic("key")(key.asInstanceOf[js.Any])
2320
React
24-
.createElement(ctor, props, children: _*)
21+
.createElement(ctor, props.asInstanceOf[js.Any], children: _*)
2522
.asInstanceOf[ReactElement { type Instance = C }]
2623
} else { // https://babeljs.io/docs/plugins/transform-react-inline-elements/
2724
if (children.length == 1) {
@@ -37,7 +34,8 @@ object CreateElementJS {
3734
`$$typeof` = js.Dynamic.global
3835
.selectDynamic("REACT_ELEMENT_TYPE"),
3936
`type` = ctor,
40-
props = props,
37+
props = props.asInstanceOf[js.Any],
38+
ref = ref,
4139
key =
4240
if (key != null) "" + key
4341
else key.asInstanceOf[js.Any]

src/main/scala/sri/core/CreateElementJSNoInline.scala

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@ import scala.scalajs.{LinkingInfo, js}
66
object CreateElementJSNoInline {
77

88
@inline
9-
def apply[C <: ReactClass](ctor: C,
10-
props: js.Any,
11-
key: String | Int = null,
12-
ref: C => Unit = null,
13-
children: js.Array[ReactNode] = emptyJSArray())
9+
def apply[C <: ReactClass](ctor: ComponentConstructor {
10+
type ComponentType = C
11+
}, props: C#PropsType, key: String | Int = null, ref: js.Function1[C, Unit] = null, children: js.Array[ReactNode] = emptyJSArray())
1412
: ReactElement { type Instance = C } = {
1513

1614
if (ref != null)
@@ -20,7 +18,7 @@ object CreateElementJSNoInline {
2018
.asInstanceOf[js.Dynamic]
2119
.updateDynamic("key")(key.asInstanceOf[js.Any])
2220
React
23-
.createElement(ctor, props, children: _*)
21+
.createElement(ctor, props.asInstanceOf[js.Any], children: _*)
2422
.asInstanceOf[ReactElement { type Instance = C }]
2523
}
2624

src/main/scala/sri/core/CreateElementNoProps.scala

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ import scala.scalajs.js.{ConstructorTag, |}
66
object CreateElementNoProps {
77

88
@inline
9-
def apply[C <: ReactScalaClass { type Props = Unit }: ConstructorTag](
10-
key: String | Int = null,
11-
ref: C => Unit = null,
12-
children: js.Array[ReactNode] = emptyJSArray())
9+
def apply[C <: ReactScalaClass {
10+
type PropsType = JSProps { type ScalaProps = Null }
11+
}: ConstructorTag](key: String | Int = null,
12+
ref: js.Function1[C, Unit] = null,
13+
children: js.Array[ReactNode] = emptyJSArray())
1314
: ReactElement { type Instance = C } = {
14-
CreateElementJS(
15-
js.constructorTag[C].constructor.asInstanceOf[C],
16-
js.Dynamic.literal(sprops = ()),
15+
CreateElementJS[C](
16+
componentConstructor[C],
17+
JSProps(scalaProps = null),
1718
key = key,
1819
ref = ref,
1920
children
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package sri.core
2+
3+
import scala.scalajs.js
4+
import scala.scalajs.js.{ConstructorTag, |}
5+
6+
object CreateElementNoPropsWithChildren {
7+
8+
@inline
9+
def apply[C <: ReactScalaClass {
10+
type PropsType = JSProps { type ScalaProps = Null }
11+
}: ConstructorTag](
12+
key: String | Int = null,
13+
ref: js.Function1[C, Unit] = null,
14+
children: js.Array[ReactNode]): ReactElement { type Instance = C } = {
15+
CreateElementJS[C](
16+
componentConstructor[C],
17+
JSProps(scalaProps = null),
18+
key = key,
19+
ref = ref,
20+
children = children
21+
)
22+
}
23+
24+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package sri.core
2+
3+
import scala.scalajs.js
4+
import scala.scalajs.js.{ConstructorTag, |}
5+
6+
object CreateElementSF {
7+
8+
@inline
9+
def apply[C <: ReactClass, P](func: P => ReactElement { type Instance = C }, props: P, key: String | Int = null)
10+
: ReactElement { type Instance = C } = {
11+
js.Dynamic
12+
.literal(
13+
`$$typeof` = js.Dynamic.global
14+
.selectDynamic("REACT_ELEMENT_TYPE"),
15+
`type` = func,
16+
props = props.asInstanceOf[js.Any],
17+
key =
18+
if (key != null) "" + key
19+
else null,
20+
ref = null
21+
)
22+
.asInstanceOf[ReactElement { type Instance = C }]
23+
}
24+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package sri.core
2+
3+
import scala.scalajs.js
4+
import scala.scalajs.js.|
5+
6+
object CreateElementSFNoP {
7+
8+
@inline
9+
def apply[C <: ReactClass](func: () => ReactElement { type Instance = C }, key: String | Int = null)
10+
: ReactElement { type Instance = C } = {
11+
js.Dynamic
12+
.literal(
13+
`$$typeof` = js.Dynamic.global
14+
.selectDynamic("REACT_ELEMENT_TYPE"),
15+
`type` = func,
16+
props = js.Dynamic.literal(),
17+
key =
18+
if (key != null) "" + key
19+
else null,
20+
ref = null
21+
)
22+
.asInstanceOf[ReactElement { type Instance = C }]
23+
}
24+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package sri.core
2+
3+
import scala.scalajs.js
4+
import scala.scalajs.js.{ConstructorTag, |}
5+
6+
object CreateElementWithChildren {
7+
8+
@inline
9+
def apply[C <: ReactScalaClass: ConstructorTag](
10+
props: C#ScalaPropsType,
11+
key: String | Int = null,
12+
ref: js.Function1[C, Unit] = null,
13+
children: js.Array[ReactNode]): ReactElement { type Instance = C } = {
14+
CreateElementJS[C](
15+
componentConstructor[C],
16+
JSProps(props),
17+
key = key,
18+
ref = ref,
19+
children = children
20+
)
21+
}
22+
23+
}

src/main/scala/sri/core/CreateFunctionElement.scala

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/main/scala/sri/core/CreateFunctionElementNoProps.scala

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/main/scala/sri/core/MergeJSObjects.scala

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)