Skip to content

Commit cfb58b1

Browse files
committed
Merge pull request #213 from xsistens/master
Scala.js version update to 0.6.5
2 parents 58cf2f4 + b20606b commit cfb58b1

File tree

10 files changed

+70
-1
lines changed

10 files changed

+70
-1
lines changed

core/src/main/scala/japgolly/scalajs/react/Addons.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,17 @@ object Addons {
6666
*
6767
* https://facebook.github.io/react/docs/perf.html
6868
*/
69+
@js.native
6970
@JSName("React.addons.Perf")
7071
object Perf extends js.Object {
7172
type Measurements = js.Array[Measurement]
7273

74+
@js.native
7375
sealed trait Measurement extends js.Object {
7476
val totalTime: Double = js.native
7577
}
7678

79+
@js.native
7780
sealed trait Report extends js.Object
7881

7982
def start(): Unit = js.native

core/src/main/scala/japgolly/scalajs/react/Events.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ object ReactKeyboardEvent {
6868
}
6969

7070
/** https://facebook.github.io/react/docs/events.html */
71+
@js.native
7172
trait SyntheticEvent[+DOMEventTarget <: dom.Node] extends js.Object {
7273
val bubbles : Boolean = js.native
7374
val cancelable : Boolean = js.native
@@ -91,6 +92,7 @@ trait SyntheticEvent[+DOMEventTarget <: dom.Node] extends js.Object {
9192
}
9293

9394
/** https://github.com/facebook/react/blob/master/src/browser/syntheticEvents/SyntheticUIEvent.js */
95+
@js.native
9496
trait SyntheticUIEvent[+DOMEventTarget <: dom.Node] extends SyntheticEvent[DOMEventTarget] {
9597
override val nativeEvent: dom.UIEvent = js.native
9698
/**
@@ -106,6 +108,7 @@ trait SyntheticUIEvent[+DOMEventTarget <: dom.Node] extends SyntheticEvent[DOMEv
106108
}
107109

108110
/** https://github.com/facebook/react/blob/master/src/browser/syntheticEvents/SyntheticClipboardEvent.js */
111+
@js.native
109112
trait SyntheticClipboardEvent[+DOMEventTarget <: dom.Node] extends SyntheticEvent[DOMEventTarget] {
110113
/**
111114
* The clipboardData attribute is an instance of the DataTransfer interface which lets a script read and manipulate
@@ -122,6 +125,7 @@ trait SyntheticClipboardEvent[+DOMEventTarget <: dom.Node] extends SyntheticEven
122125
}
123126

124127
/** https://github.com/facebook/react/blob/master/src/browser/syntheticEvents/SyntheticCompositionEvent.js */
128+
@js.native
125129
trait SyntheticCompositionEvent[+DOMEventTarget <: dom.Node] extends SyntheticEvent[DOMEventTarget] {
126130
override val nativeEvent: dom.CompositionEvent = js.native
127131
/**
@@ -136,12 +140,14 @@ trait SyntheticCompositionEvent[+DOMEventTarget <: dom.Node] extends SyntheticEv
136140
}
137141

138142
/** https://github.com/facebook/react/blob/master/src/browser/syntheticEvents/SyntheticDragEvent.js */
143+
@js.native
139144
trait SyntheticDragEvent[+DOMEventTarget <: dom.Node] extends SyntheticMouseEvent[DOMEventTarget] {
140145
override val nativeEvent: dom.DragEvent = js.native
141146
val dataTransfer: dom.DataTransfer = js.native
142147
}
143148

144149
/** https://github.com/facebook/react/blob/master/src/browser/syntheticEvents/SyntheticFocusEvent.js */
150+
@js.native
145151
trait SyntheticFocusEvent[+DOMEventTarget <: dom.Node] extends SyntheticUIEvent[DOMEventTarget] {
146152
override val nativeEvent: dom.FocusEvent = js.native
147153
val relatedTarget: dom.EventTarget = js.native
@@ -162,6 +168,7 @@ trait SyntheticFocusEvent[+DOMEventTarget <: dom.Node] extends SyntheticUIEvent[
162168
//}
163169

164170
/** https://github.com/facebook/react/blob/master/src/browser/syntheticEvents/SyntheticKeyboardEvent.js */
171+
@js.native
165172
trait SyntheticKeyboardEvent[+DOMEventTarget <: dom.Node] extends SyntheticUIEvent[DOMEventTarget] {
166173
override val nativeEvent: dom.KeyboardEvent = js.native
167174
/** See org.scalajs.dom.extensions.KeyValue */
@@ -180,6 +187,7 @@ trait SyntheticKeyboardEvent[+DOMEventTarget <: dom.Node] extends SyntheticUIEve
180187
}
181188

182189
/** https://github.com/facebook/react/blob/master/src/browser/syntheticEvents/SyntheticMouseEvent.js */
190+
@js.native
183191
trait SyntheticMouseEvent[+DOMEventTarget <: dom.Node] extends SyntheticUIEvent[DOMEventTarget] {
184192
override val nativeEvent: dom.MouseEvent = js.native
185193
val screenX : Double = js.native
@@ -199,6 +207,7 @@ trait SyntheticMouseEvent[+DOMEventTarget <: dom.Node] extends SyntheticUIEvent[
199207
}
200208

201209
/** https://github.com/facebook/react/blob/master/src/browser/syntheticEvents/SyntheticTouchEvent.js */
210+
@js.native
202211
trait SyntheticTouchEvent[+DOMEventTarget <: dom.Node] extends SyntheticUIEvent[DOMEventTarget] {
203212
override val nativeEvent: dom.TouchEvent = js.native
204213
val altKey : Boolean = js.native
@@ -212,6 +221,7 @@ trait SyntheticTouchEvent[+DOMEventTarget <: dom.Node] extends SyntheticUIEvent[
212221
}
213222

214223
/** https://github.com/facebook/react/blob/master/src/browser/syntheticEvents/SyntheticWheelEvent.js */
224+
@js.native
215225
trait SyntheticWheelEvent[+DOMEventTarget <: dom.Node] extends SyntheticMouseEvent[DOMEventTarget] {
216226
override val nativeEvent: dom.WheelEvent = js.native
217227
def deltaX(event: dom.Event): Double = js.native

core/src/main/scala/japgolly/scalajs/react/FunctionalComponent.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import scala.scalajs.js
1515
*
1616
* @since React 0.14
1717
*/
18+
@js.native
1819
sealed trait FunctionalComponent[-P] extends js.Any
1920
// type FunctionalComponent[-P] = js.Function1[P, ReactElement]
2021
// ↑ Doesn't work for Scala for two reasons:
@@ -46,6 +47,7 @@ object FunctionalComponent {
4647
/**
4748
* A [[FunctionalComponent]] that accepts [[PropsChildren]] in addition to `props`.
4849
*/
50+
@js.native
4951
sealed trait WithChildren[-P] extends js.Any
5052

5153
def withChildren[P](render: (P, PropsChildren) => ReactElement): WithChildren[P] = {

core/src/main/scala/japgolly/scalajs/react/React.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ import org.scalajs.dom
44
import scala.scalajs.js
55
import js.{Dynamic, UndefOr, ThisFunction, ThisFunction0, Object, Any => JAny}
66

7+
@js.native
78
object React extends React
9+
10+
@js.native
811
trait React extends Object {
912

1013
/**
@@ -113,6 +116,7 @@ trait React extends Object {
113116
}
114117

115118
/** `React.Children` */
119+
@js.native
116120
trait ReactChildren extends Object {
117121

118122
/** Invoke fn on every immediate child contained within children with this set to context. If children is a nested object or array it will be traversed: fn will never be passed the container objects. If children is null or undefined returns null or undefined rather than an empty object. */

core/src/main/scala/japgolly/scalajs/react/ReactDOM.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ import org.scalajs.dom
44
import scala.scalajs.js
55
import js.{ThisFunction, ThisFunction0, Object}
66

7+
@js.native
78
object ReactDOM extends ReactDOM
9+
10+
@js.native
811
trait ReactDOM extends Object {
912

1013
/**

core/src/main/scala/japgolly/scalajs/react/package.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package object react extends ReactEventAliases {
1919
* If P,S,B,N types are needed and there's another object that has them, this is used to bridge for type inference.
2020
*/
2121
trait ReactComponentTypeAux[P, S, +B, +N <: TopNode]
22+
@js.native
2223
trait ReactComponentTypeAuxJ[P, S, +B, +N <: TopNode] extends js.Object
2324
implicit def reactComponentTypeAuxJ[P, S, B, N <: TopNode](a: ReactComponentTypeAuxJ[P,S,B,N]): ReactComponentTypeAux[P,S,B,N] =
2425
a.asInstanceOf[ReactComponentTypeAux[P,S,B,N]]
@@ -30,6 +31,7 @@ package object react extends ReactEventAliases {
3031

3132
// TODO WrapObj was one of the first things I did when starting with ScalaJS. Reconsider.
3233
/** Allows Scala classes to be used in place of `Object`. */
34+
@js.native
3335
trait WrapObj[+A] extends Object { val v: A = js.native }
3436
def WrapObj[A](v: A) =
3537
Dynamic.literal("v" -> v.asInstanceOf[JAny]).asInstanceOf[WrapObj[A]]

core/src/main/scala/japgolly/scalajs/react/types.scala

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,40 @@ import js.annotation.{JSBracketAccess, JSName}
1111
object CompScope {
1212

1313
/** Methods always available. */
14+
@js.native
1415
trait AlwaysAvailable extends Object {
1516
def isMounted(): Boolean = js.native
1617
}
1718

19+
@js.native
1820
trait HasProps[+Props] extends Object {
1921
@JSName("props") private[react] def _props: WrapObj[Props] with PropsMixedIn = js.native
2022
}
2123

24+
@js.native
2225
trait HasState[+State] extends Object {
2326
@JSName("state") private[react] def _state: WrapObj[State] = js.native
2427
}
2528

29+
@js.native
2630
trait CanSetState[State] extends HasState[State] {
2731
@JSName("setState") private[react] def _setState(s: WrapObj[State]): Unit = js.native
2832
@JSName("setState") private[react] def _setState(s: WrapObj[State], callback: UndefOr[JFn]): Unit = js.native
2933
@JSName("setState") private[react] def _modState(s: js.Function1[WrapObj[State], WrapObj[State]], callback: UndefOr[JFn]): Unit = js.native
3034
}
3135

36+
@js.native
3237
trait HasBackend[+Backend] extends Object {
3338
def backend: Backend = js.native
3439
}
3540

41+
@js.native
3642
trait CanGetInitialState[-Props, +State] extends Object {
3743
@JSName("getInitialState") private[react] def _getInitialState(s: WrapObj[Props]): WrapObj[State] = js.native
3844
}
3945

4046
/** Functions available to components when they're mounted. */
47+
@js.native
4148
trait Mounted[+Node <: TopNode] extends Object {
4249
def refs: RefsObject = js.native
4350

@@ -57,11 +64,16 @@ object CompScope {
5764
@JSName("forceUpdate") private[react] def _forceUpdate(): Unit = js.native
5865
}
5966

67+
@js.native
6068
trait ReadDirect extends Object
69+
@js.native
6170
trait ReadCallback extends Object
71+
@js.native
6272
trait WriteDirect extends Object
73+
@js.native
6374
trait WriteCallback extends Object
6475

76+
@js.native
6577
trait AnyUnmounted[Props, State, +Backend]
6678
extends AlwaysAvailable
6779
with HasProps[Props]
@@ -70,26 +82,31 @@ object CompScope {
7082
with HasBackend[Backend]
7183
// prohibits: IsMounted
7284

85+
@js.native
7386
trait AnyMounted[Props, State, +Backend, +Node <: TopNode]
7487
extends AnyUnmounted[Props, State, Backend]
7588
with Mounted[Node]
7689
with ReactComponentTypeAuxJ[Props, State, Backend, Node]
7790

91+
@js.native
7892
trait AnyDuringCallback
7993
extends ReadDirect
8094
with WriteCallback
8195

8296
/** Type of an unmounted component's `this` scope, as available within lifecycle methods. */
97+
@js.native
8398
trait DuringCallbackU[Props, State, +Backend]
8499
extends AnyUnmounted[Props, State, Backend]
85100
with AnyDuringCallback
86101

87102
/** Type of a mounted component's `this` scope, as available within lifecycle methods. */
103+
@js.native
88104
trait DuringCallbackM[Props, State, +Backend, +Node <: TopNode]
89105
extends AnyMounted[Props, State, Backend, Node]
90106
with AnyDuringCallback
91107

92108
/** Type of a component's `this` scope during componentWillUpdate. */
109+
@js.native
93110
trait WillUpdate[Props, +State, +Backend, +Node <: TopNode]
94111
extends AlwaysAvailable
95112
with HasProps[Props]
@@ -104,6 +121,7 @@ object CompScope {
104121
import CompScope._
105122

106123
/** Type of a component's `this` scope as is available to backends. */
124+
@js.native
107125
trait BackendScope[Props, State]
108126
extends AlwaysAvailable
109127
with HasProps[Props]
@@ -117,61 +135,73 @@ trait BackendScope[Props, State]
117135
// =====================================================================================================================
118136

119137
/** Type of `this.refs` */
138+
@js.native
120139
trait RefsObject extends Object {
121140
@JSBracketAccess
122141
def apply[Node <: TopNode](key: String): UndefOr[ReactComponentM_[Node]] = js.native
123142
}
124143

125144
/** Additional methods that React mixes into `this.props` */
145+
@js.native
126146
trait PropsMixedIn extends Object {
127147
def children: PropsChildren = js.native
128148
}
129149

130150
/** Type of `this.props.children` */
151+
@js.native
131152
trait PropsChildren extends Object
132153

133154
/**
134155
* https://facebook.github.io/react/docs/glossary.html indicates children can be a super type of ReactElement.
135156
* Array and null are acceptable, thus this can be 0-n elements.
136157
*/
158+
@js.native
137159
trait ReactNode extends Object
138160

139161
/** ReactElement = ReactComponentElement | ReactDOMElement */
162+
@js.native
140163
trait ReactElement extends Object with ReactNode {
141164
def key: UndefOr[String] = js.native
142165
def ref: UndefOr[String] = js.native
143166
}
144167

145168
/** A React virtual DOM element, such as 'div', 'table', etc. */
169+
@js.native
146170
trait ReactDOMElement extends ReactElement {
147171
def `type`: String = js.native
148172
def props : Object = js.native
149173
}
150174

151175
/** An instance of a React component. Prefer using the subtype ReactComponentU instead. */
176+
@js.native
152177
trait ReactComponentElement[Props]
153178
extends ReactElement
154179
with HasProps[Props]
155180

156181
/** A JS function that creates a React component instance. */
182+
@js.native
157183
trait ReactComponentC_ extends JFn
158184

159185
/** An unmounted component. Not guaranteed to have been created by Scala, could be a React addon. */
186+
@js.native
160187
trait ReactComponentU_ extends ReactElement
161188

162189
/** A mounted component. Not guaranteed to have been created by Scala, could be a React addon. */
190+
@js.native
163191
trait ReactComponentM_[+Node <: TopNode]
164192
extends ReactComponentU_
165193
with Mounted[Node]
166194

167195
/** The underlying function that creates a Scala-based React component instance. */
196+
@js.native
168197
trait ReactComponentCU[Props, State, +Backend, +Node <: TopNode]
169198
extends ReactComponentC_
170199
with ReactComponentTypeAuxJ[Props, State, Backend, Node] {
171200
def apply(props: WrapObj[Props], children: ReactNode*): ReactComponentU[Props, State, Backend, Node] = js.native
172201
}
173202

174203
/** An unmounted Scala component. */
204+
@js.native
175205
trait ReactComponentU[Props, State, +Backend, +Node <: TopNode]
176206
extends ReactComponentU_
177207
with AnyUnmounted[Props, State, Backend]
@@ -180,30 +210,37 @@ trait ReactComponentU[Props, State, +Backend, +Node <: TopNode]
180210
with WriteDirect
181211

182212
/** A mounted Scala component. */
213+
@js.native
183214
trait ReactComponentM[Props, State, +Backend, +Node <: TopNode]
184215
extends ReactComponentU[Props, State, Backend, Node]
185216
with ReactComponentM_[Node]
186217
with AnyMounted[Props, State, Backend, Node]
187218

219+
@js.native
188220
trait ReactComponentSpec[Props, State, +Backend, +Node <: TopNode] extends Object with ReactComponentTypeAuxJ[Props, State, Backend, Node]
189221

190222
/**
191223
* A component created via [[React.createClass]].
192224
*/
225+
@js.native
193226
trait ReactClass[Props, State, +Backend, +Node <: TopNode] extends Object with ReactComponentTypeAuxJ[Props, State, Backend, Node]
194227

195228
// =====================================================================================================================
196229

230+
@js.native
197231
trait JsComponentType[Props <: js.Any, State <: js.Any, +Node <: TopNode] extends Object
198232

233+
@js.native
199234
trait JsComponentC[Props <: js.Any, State <: js.Any, +Node <: TopNode] extends ReactComponentC_ with JsComponentType[Props, State, Node] {
200235
def apply(props: Props, children: ReactNode*): JsComponentU[Props, State, Node] = js.native
201236
}
202237

238+
@js.native
203239
trait JsComponentU[Props <: js.Any, State <: js.Any, +Node <: TopNode]
204240
extends ReactComponentU_
205241
with JsComponentType[Props, State, Node]
206242

243+
@js.native
207244
trait JsComponentM[Props <: js.Any, State <: js.Any, +Node <: TopNode]
208245
extends JsComponentU[Props, State, Node]
209246
with Mounted[Node] with ReactComponentM_[Node] {

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.4")
1+
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.5")
22

33
addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.3")
44

test/src/main/scala/japgolly/scalajs/react/test/ReactTestUtils.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
package japgolly.scalajs.react.test
22

3+
import scala.scalajs.js
34
import scala.scalajs.js.{Function1 => JFn1, Object, Array, UndefOr, undefined, Dynamic, native}
45
import scala.scalajs.js.annotation.JSName
56
import japgolly.scalajs.react._
67

78
/** https://facebook.github.io/react/docs/test-utils.html */
9+
@js.native
810
@JSName("React.addons.TestUtils")
911
object ReactTestUtils extends ReactTestUtils
12+
13+
@js.native
1014
trait ReactTestUtils extends Object {
1115

1216
def Simulate: Simulate = native
@@ -74,6 +78,7 @@ trait ReactTestUtils extends Object {
7478
def findRenderedComponentWithType(tree: ComponentM, c: ComponentClass): ComponentM = native
7579
}
7680

81+
@js.native
7782
trait Simulate extends Object {
7883
def beforeInput (t: ReactOrDomNode, eventData: Object = native): Unit = native
7984
def blur (t: ReactOrDomNode, eventData: Object = native): Unit = native

0 commit comments

Comments
 (0)