@@ -11,33 +11,40 @@ import js.annotation.{JSBracketAccess, JSName}
1111object 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 {
104121import CompScope ._
105122
106123/** Type of a component's `this` scope as is available to backends. */
124+ @ js.native
107125trait 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
120139trait 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
126146trait PropsMixedIn extends Object {
127147 def children : PropsChildren = js.native
128148}
129149
130150/** Type of `this.props.children` */
151+ @ js.native
131152trait 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
137159trait ReactNode extends Object
138160
139161/** ReactElement = ReactComponentElement | ReactDOMElement */
162+ @ js.native
140163trait 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
146170trait 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
152177trait ReactComponentElement [Props ]
153178 extends ReactElement
154179 with HasProps [Props ]
155180
156181/** A JS function that creates a React component instance. */
182+ @ js.native
157183trait ReactComponentC_ extends JFn
158184
159185/** An unmounted component. Not guaranteed to have been created by Scala, could be a React addon. */
186+ @ js.native
160187trait ReactComponentU_ extends ReactElement
161188
162189/** A mounted component. Not guaranteed to have been created by Scala, could be a React addon. */
190+ @ js.native
163191trait 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
168197trait 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
175205trait 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
183214trait 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
188220trait 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
193226trait ReactClass [Props , State , + Backend , + Node <: TopNode ] extends Object with ReactComponentTypeAuxJ [Props , State , Backend , Node ]
194227
195228// =====================================================================================================================
196229
230+ @ js.native
197231trait JsComponentType [Props <: js.Any , State <: js.Any , + Node <: TopNode ] extends Object
198232
233+ @ js.native
199234trait 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
203239trait JsComponentU [Props <: js.Any , State <: js.Any , + Node <: TopNode ]
204240 extends ReactComponentU_
205241 with JsComponentType [Props , State , Node ]
206242
243+ @ js.native
207244trait JsComponentM [Props <: js.Any , State <: js.Any , + Node <: TopNode ]
208245 extends JsComponentU [Props , State , Node ]
209246 with Mounted [Node ] with ReactComponentM_ [Node ] {
0 commit comments