Skip to content

Commit ec712d5

Browse files
committed
push it baby ...
1 parent a225c82 commit ec712d5

Some content is hidden

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

56 files changed

+1805
-2218
lines changed

.travis.credentials.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
mkdir ~/.bintray/
6+
7+
cat <<EOF > $HOME/.bintray/.credentials
8+
realm = Bintray API Realm
9+
host = api.bintray.com
10+
user = $BINTRAY_USER
11+
password = $BINTRAY_PASSWORD
12+
EOF

.travis.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
language: scala
2+
3+
scala:
4+
- 2.12.1
5+
- 2.11.8
6+
7+
jdk:
8+
- oraclejdk8
9+
10+
install:
11+
- . $HOME/.nvm/nvm.sh
12+
- nvm install stable
13+
- nvm use stable
14+
- npm install
15+
16+
env:
17+
global:
18+
JSENV=node
19+
20+
script:
21+
- sbt ++$TRAVIS_SCALA_VERSION test:fastOptJS test:fullOptJS
22+
- sbt ++$TRAVIS_SCALA_VERSION 'set parallelExecution in ThisBuild := false' test
23+
- sbt ++$TRAVIS_SCALA_VERSION 'set parallelExecution in ThisBuild := false' 'set scalaJSStage in ThisBuild := FullOptStage' test
24+
25+
26+
deploy:
27+
provider: script
28+
script:
29+
- /bin/bash "$TRAVIS_BUILD_DIR/.travis.credentials.sh" && sbt ++$TRAVIS_SCALA_VERSION publish
30+
on:
31+
tags: true
32+
33+
env:
34+
global:
35+
# travis encrypt BINTRAY_USER=xxx
36+
- secure: "ReSwtDltRZnVqq5OSAWhRNsGaLEy97p1OIdXwJmsiWju35ckUX+qE7SHpkj2Az50654S3Y358wI4cKy6e7nZO2KDYfSECBorIqRayboW4NwiIMUAgRi/PBK3xZDZkWbo9qj1qvc8SxEgGBAvBmrOiWu6bWJTZdMeWusv418Zl4UQidY9QFE7FlwURxfcf0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W0Bg1KFB7wwvn5i+ici6VwswmF+VwrACuMPwoJ4TqqhEHwi3CK88+6sdtkMgNJ8xCWJfS7++eqBNdge/schT5MczyGMqJsch/C16FESbroexPhp4ZX1PyFyHUb4fHSqDfrQ1KWqvZcROk="
39+

build.sbt

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,37 @@
11
name := "universal"
22

3-
version := "2017.1.15"
3+
//version := "2017.2.0-SNAPSHOT"
44

55
enablePlugins(ScalaJSPlugin)
66

77
val scala211 = "2.11.8"
88

9-
val scala212 = "2.12.0"
9+
val scala212 = "2.12.1"
1010

1111
scalaVersion := scala211
1212

13-
crossScalaVersions := Seq(scala211,scala212)
13+
crossScalaVersions := Seq(scala211, scala212)
1414

1515
scalacOptions ++= Seq(
1616
"-feature",
1717
"-deprecation",
1818
"-unchecked",
19+
"-language:existentials",
1920
"-language:implicitConversions"
2021
)
2122

2223
//Dependencies
23-
libraryDependencies += "scalajs-react-universe" %%% "core" % "2017.1.15"
24+
libraryDependencies += "scalajs-react-universe" %%% "core" % "2017.3.21-beta" % Provided
25+
libraryDependencies += "scalajs-react-universe" %%% "macros" % "2017.3.22-beta"
2426
libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "0.9.1"
2527

26-
2728
//bintray
2829
resolvers += Resolver.jcenterRepo
2930

3031
organization := "scalajs-react-universe"
3132

32-
licenses += ("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0.html"))
33+
licenses += ("Apache-2.0", url(
34+
"https://www.apache.org/licenses/LICENSE-2.0.html"))
3335

3436
bintrayOrganization := Some("scalajs-react-universe")
3537

@@ -42,5 +44,6 @@ publishArtifact in Test := false
4244
//Test
4345
resolvers += Resolver.bintrayRepo("scalajs-react-universe", "maven")
4446
libraryDependencies += "org.scalatest" %%% "scalatest" % "3.0.0" % Test
45-
//libraryDependencies += "scalajs-react-universe" %%% "enzyme" % "2017.1.0" % Test
4647
scalaJSStage in Global := FastOptStage
48+
49+
scalaJSModuleKind in Test := ModuleKind.CommonJSModule

package.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "sr--test",
3+
"version": "0.1.0",
4+
"description": "sri test",
5+
"repository": {
6+
"type": "git",
7+
"url": ""
8+
},
9+
"scripts": {
10+
"start": "webpack --watch & webpack-dev-server --progress --colors --port 8090",
11+
"build": "webpack --watch"
12+
},
13+
"devDependencies": {
14+
"jsdom-global": "2.1.1",
15+
"jsdom": "^9.9.1"
16+
},
17+
"dependencies": {
18+
19+
}
20+
}

project/plugins.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.14")
1+
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.15")
22
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0")
33
addSbtPlugin("me.lessis" % "bintray-sbt" % "0.3.0")
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package sri.universal
2+
3+
import scala.reflect.ClassTag
4+
import scala.scalajs.js
5+
import scala.scalajs.js.|
6+
7+
trait DangerousUnionToJSAnyImplicit {
8+
implicit def UnionEvidence[A: ClassTag, B: ClassTag](
9+
ab: A | B)(implicit eva: A => js.Any, evb: B => js.Any): js.Any =
10+
ab.asInstanceOf[js.Any]
11+
}
12+
13+
object DangerousUnionToJSAnyImplicit extends DangerousUnionToJSAnyImplicit
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
package sri.universal
2+
3+
import scala.scalajs.js
4+
5+
trait FunctionToUndefOrJSFunctionImplicits {
6+
implicit def FtoJSF0[R](
7+
in: scala.Function0[R]): js.UndefOr[js.Function0[R]] = {
8+
js.defined(in: js.Function0[R])
9+
}
10+
11+
implicit def FtoJSF1[P1, R](
12+
in: scala.Function1[P1, R]): js.UndefOr[js.Function1[P1, R]] = {
13+
js.defined(in: js.Function1[P1, R])
14+
}
15+
16+
implicit def FtoJSF2[P1, P2, R](
17+
in: scala.Function2[P1, P2, R]): js.UndefOr[js.Function2[P1, P2, R]] = {
18+
js.defined(in: js.Function2[P1, P2, R])
19+
}
20+
21+
implicit def FtoJSF3[P1, P2, P3, R](in: scala.Function3[P1, P2, P3, R])
22+
: js.UndefOr[js.Function3[P1, P2, P3, R]] = {
23+
js.defined(in: js.Function3[P1, P2, P3, R])
24+
}
25+
26+
implicit def FtoJSF4[P1, P2, P3, P4, R](
27+
in: scala.Function4[P1, P2, P3, P4, R])
28+
: js.UndefOr[js.Function4[P1, P2, P3, P4, R]] = {
29+
js.defined(in: js.Function4[P1, P2, P3, P4, R])
30+
}
31+
32+
implicit def FtoJSF5[P1, P2, P3, P4, P5, R](
33+
in: scala.Function5[P1, P2, P3, P4, P5, R])
34+
: js.UndefOr[js.Function5[P1, P2, P3, P4, P5, R]] = {
35+
js.defined(in: js.Function5[P1, P2, P3, P4, P5, R])
36+
}
37+
38+
implicit def FtoJSF6[P1, P2, P3, P4, P5, P6, R](
39+
in: scala.Function6[P1, P2, P3, P4, P5, P6, R])
40+
: js.UndefOr[js.Function6[P1, P2, P3, P4, P5, P6, R]] = {
41+
js.defined(in: js.Function6[P1, P2, P3, P4, P5, P6, R])
42+
}
43+
44+
implicit def FtoJSF7[P1, P2, P3, P4, P5, P6, P7, R](
45+
in: scala.Function7[P1, P2, P3, P4, P5, P6, P7, R])
46+
: js.UndefOr[js.Function7[P1, P2, P3, P4, P5, P6, P7, R]] = {
47+
js.defined(in: js.Function7[P1, P2, P3, P4, P5, P6, P7, R])
48+
}
49+
50+
implicit def FtoJSF8[P1, P2, P3, P4, P5, P6, P7, P8, R](
51+
in: scala.Function8[P1, P2, P3, P4, P5, P6, P7, P8, R])
52+
: js.UndefOr[js.Function8[P1, P2, P3, P4, P5, P6, P7, P8, R]] = {
53+
js.defined(in: js.Function8[P1, P2, P3, P4, P5, P6, P7, P8, R])
54+
}
55+
}
56+
57+
object FunctionToUndefOrJSFunctionImplicits
58+
extends FunctionToUndefOrJSFunctionImplicits {}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package sri.universal
2+
3+
import scala.scalajs.js
4+
5+
object MergeJSObjects {
6+
7+
@inline def apply(in: js.Object, extra: js.Object) = {
8+
js.Object
9+
.keys(extra)
10+
.foreach(
11+
key =>
12+
in.asInstanceOf[js.Dynamic]
13+
.updateDynamic(key)(
14+
extra.asInstanceOf[js.Dynamic].selectDynamic(key)))
15+
}
16+
}

src/main/scala/sri/universal/ReactUniversal.scala

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
package sri.universal
22

33
import sri.core.ReactClass
4-
import sri.universal.apis.{Animated, AppRegistry, AsyncStorageJS, DeviceEventEmitter, Keyboard, PanResponder, PixelRatio, ReactPlatForm, StyleSheet}
4+
import sri.universal.apis.{
5+
Animated,
6+
AppRegistry,
7+
AsyncStorage,
8+
DeviceEventEmitter,
9+
Keyboard,
10+
PanResponder,
11+
PixelRatio,
12+
ReactPlatForm,
13+
StyleSheet
14+
}
515

616
import scala.scalajs.js
717

8-
918
@js.native
1019
trait ReactUniversal extends js.Object {
1120
//components
@@ -30,14 +39,12 @@ trait ReactUniversal extends js.Object {
3039
val Slider: ReactClass = js.native
3140
val ActivityIndicator: ReactClass = js.native
3241

33-
3442
val NavigationExperimental: js.Dynamic = js.native
3543

36-
3744
// apis
3845
//
3946
val StyleSheet: StyleSheet = js.native
40-
val AsyncStorage: AsyncStorageJS = js.native
47+
val AsyncStorage: AsyncStorage = js.native
4148
val AppRegistry: AppRegistry = js.native
4249
val Keyboard: Keyboard = js.native
4350
// val CameraRoll: CameraRoll = js.native
@@ -62,4 +69,3 @@ trait ReactUniversal extends js.Object {
6269
//@js.native
6370
//@JSImport("react-native", JSImport.Namespace)
6471
//object ReactUniversal extends ReactUniversal
65-
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package sri.universal
2+
3+
trait SriPlatForm {
4+
def isAndroid: Boolean
5+
def isIOS: Boolean
6+
def isWeb: Boolean
7+
}

src/main/scala/sri/universal/apis/Alert.scala

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,48 @@ import scala.scalajs.js.annotation.{JSImport, ScalaJSDefined}
66

77
@js.native
88
trait Alert extends js.Object {
9-
def alert(title: String = ???, message: String = ???, buttons: js.Array[AlertButton] = ???, options: AlertOptions = ???, `type`: String = "default"): Unit = js.native
9+
def alert(title: String = ???,
10+
message: String = ???,
11+
buttons: js.Array[AlertButton] = ???,
12+
options: AlertOptions = ???,
13+
`type`: AlertType = AlertType.DEFAULT): Unit = js.native
1014
}
1115

1216
@js.native
13-
@JSImport("react-native","Alert")
17+
@JSImport("react-native", "Alert")
1418
object Alert extends Alert
1519

1620
@ScalaJSDefined
1721
trait AlertButton extends js.Object {
1822
var text: js.UndefOr[String] = js.undefined
1923
var onPress: js.UndefOr[js.Function] = js.undefined
20-
var style: js.UndefOr[String] = js.undefined
24+
var style: js.UndefOr[AlertButtonStyle] = js.undefined
2125
}
2226

2327
@ScalaJSDefined
2428
trait AlertOptions extends js.Object {
2529
var cancelable: js.UndefOr[Boolean] = js.undefined
2630
}
2731

28-
object AlertTypes {
29-
val DEFAULT = "default"
30-
val PLAIN_TEXT = "plain-text"
31-
val SECURE_TEXT = "secure-text"
32-
val LOGIN_PASSWORD = "login-password"
32+
@ScalaJSDefined
33+
trait AlertType extends js.Object
34+
35+
object AlertType {
36+
final val DEFAULT = "default".asInstanceOf[AlertType]
37+
final val PLAIN_TEXT = "plain-text".asInstanceOf[AlertType]
38+
final val SECURE_TEXT = "secure-text".asInstanceOf[AlertType]
39+
final val LOGIN_PASSWORD = "login-password".asInstanceOf[AlertType]
3340
}
3441

35-
object AlertButtonStyles {
42+
@ScalaJSDefined
43+
trait AlertButtonStyle extends js.Object
3644

37-
val DEFAULT = "default"
45+
object AlertButtonStyle {
3846

39-
val CANCEL = "cancel"
47+
final val DEFAULT = "default".asInstanceOf[AlertButtonStyle]
4048

41-
val DESTRUCTIVE = "destructive"
49+
final val CANCEL = "cancel".asInstanceOf[AlertButtonStyle]
4250

43-
}
51+
final val DESTRUCTIVE = "destructive".asInstanceOf[AlertButtonStyle]
4452

53+
}

0 commit comments

Comments
 (0)