Skip to content

Commit

Permalink
React 0.14.0 extern improvements; closes cljsjs#265
Browse files Browse the repository at this point in the history
* Change react-dom extern path to match packaging guidelines.
* Adds missing extern symbols (especially in react-dom).
* Removes some symbols removed by React 0.14.0 (not done thoroughly).
* Marks @depreciated some symbols depreciated by React 0.14.0.
  • Loading branch information
favila authored and martinklepsch committed Oct 26, 2015
1 parent 1f8e7e7 commit bbf6f4c
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 56 deletions.
2 changes: 1 addition & 1 deletion react-dom/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[](dependency)
```clojure
[cljsjs/react-dom "0.14.0-0"] ;; latest release
[cljsjs/react-dom "0.14.0-1"] ;; latest release
```
[](/dependency)

Expand Down
2 changes: 1 addition & 1 deletion react-dom/build.boot
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(def react-version "0.14.0")
(def +version+ (str react-version "-0"))
(def +version+ (str react-version "-1"))

(set-env!
:resource-paths #{"resources"}
Expand Down
114 changes: 114 additions & 0 deletions react-dom/resources/cljsjs/react-dom/common/react-dom.ext.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/**
* @fileoverview Closure Compiler externs for Facebook ReactDOM.js DOM 0.14.0
* @see http://reactjs.org
* @externs
*/


/**
* The ReactDOM global object.
*
* @type {!Object}
* @const
*/
var ReactDOM = {};


/**
* The current version of ReactDOM.
*
* @type {string}
* @const
*/
ReactDOM.version;


/**
* @param {React.ReactComponent} container
* @param {Element} mountPoint
* @param {function=} callback
* @return {React.ReactComponent}
*/
ReactDOM.render = function(container, mountPoint, opt_callback) {};


/**
* @param {Element} container
* @return {boolean}
*/
ReactDOM.unmountComponentAtNode = function(container) {};


/**
* @param {React.ReactComponent} component
* @return {Element}
*/
ReactDOM.findDOMNode = function(component) {};


/**
* Call the provided function in a context within which calls to `setState`
* and friends are batched such that components aren't updated unnecessarily.
*
* @param {function} callback Function which calls `setState`, `forceUpdate`, etc.
* @param {*=} opt_a Optional argument to pass to the callback.
* @param {*=} opt_b Optional argument to pass to the callback.
* @param {*=} opt_c Optional argument to pass to the callback.
* @param {*=} opt_d Optional argument to pass to the callback.
* @param {*=} opt_e Optional argument to pass to the callback.
* @param {*=} opt_f Optional argument to pass to the callback.
*/
ReactDOM.unstable_batchedUpdates = function(callback, opt_a, opt_b, opt_c, opt_d, opt_e) {};

/**
* Renders a React component into the DOM in the supplied `container`.
*
* If the React component was previously rendered into `container`, this will
* perform an update on it and only mutate the DOM as necessary to reflect the
* latest React component.
*
* @param {React.ReactComponent} parentComponent The conceptual parent of this render tree.
* @param {React.ReactElement} nextElement Component element to render.
* @param {Element} container DOM element to render into.
* @param {function=} callback function triggered on completion
* @return {React.ReactComponent} Component instance rendered in `container`.
*/
ReactDOM.unstable_renderSubtreeIntoContainer = function(parentComponent, nextElement, container, opt_callback) {};


/**
* The ReactDOMServer global object.
*
* @type {!Object}
* @const
*/
var ReactDOMServer = {};


/**
* The current version of ReactDOMServer.
*
* @type {string}
* @const
*/
ReactDOMServer.version;

/**
* Render a ReactElement to its initial HTML.
*
* @param {React.ReactElement} element
* @return {string}
*/
ReactDOMServer.renderToString = function(element) {};


/**
* Similar to renderToString, except this doesn't create extra DOM attributes
* such as data-react-id, that React uses internally. This is useful if you want
* to use React as a simple static page generator, as stripping away the extra
* attributes can save lots of bytes.
*
* @param {React.ReactElement} element
* @return {string}
*/
ReactDOMServer.renderToStaticMarkup = function(element) {};
32 changes: 0 additions & 32 deletions react-dom/resources/cljsjs/react/common/react-dom.ext.js

This file was deleted.

4 changes: 2 additions & 2 deletions react/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# cljsjs/react

```clojure
[cljsjs/react "0.14.0-0"] ;; latest release
[cljsjs/react "0.14.0-1"] ;; latest release
```

This jar comes with `deps.cljs` as used by the [Foreign Libs][flibs] feature
Expand All @@ -16,7 +16,7 @@ you can require the packaged library like so:
# cljsjs/react-with-addons

```clojure
[cljsjs/react-with-addons "0.14.0-0"] ;; latest release
[cljsjs/react-with-addons "0.14.0-1"] ;; latest release
```

**Note that this JAR provides the same `cljsjs/react` module as
Expand Down
2 changes: 1 addition & 1 deletion react/build.boot
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
'[cljsjs.boot-cljsjs.packaging :refer :all])

(def react-version "0.14.0")
(def +version+ (str react-version "-0"))
(def +version+ (str react-version "-1"))
(bootlaces! +version+)

(def urls
Expand Down
26 changes: 7 additions & 19 deletions react/resources/cljsjs/react/common/react.ext.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
/**
* @fileoverview Closure Compiler externs for Facebook React.js 0.14.0-rc1
* @fileoverview Closure Compiler externs for Facebook React.js 0.14.0
* @see http://reactjs.org
* @externs
*/

/**
* @type {Object}
* @type {!Object}
* @const
*/
var React = {};

/**
* @type {string}
* @const
*/
React.version;

/**
* @param {boolean} shouldUseTouch
*/
React.initializeTouchEvents = function(shouldUseTouch) {};

React.createClass = function(specification) {};
React.createFactory = function(reactClass) {};

Expand Down Expand Up @@ -50,12 +46,15 @@ React.renderComponent = function(container, mountPoint, callback) {};
* @param {Element} mountPoint
* @param {Function=} callback
* @return {React.ReactComponent}
* @deprecated
*/
React.render = function(container, mountPoint, callback) {};


/**
* @param {Element} container
* @return {boolean}
* @deprecated
*/
React.unmountComponentAtNode = function(container) {};

Expand All @@ -64,25 +63,13 @@ React.unmountComponentAtNode = function(container) {};
* @return {string}
* @deprecated
*/
React.renderComponentToString = function(component) {};

/**
* @param {React.ReactComponent} component
* @return {string}
*/
React.renderToString = function(component) {};

/**
* @param {React.ReactComponent} component
* @return {string}
* @deprecated
*/
React.renderComponentToStaticMarkup = function(component) {};

/**
* @param {React.ReactComponent} component
* @return {string}
*/
React.renderToStaticMarkup = function(component) {};

/**
Expand All @@ -108,6 +95,7 @@ React.constructAndRenderComponent = function(constructor, props, container) {};
React.constructAndRenderComponentByID = function(componentConstructor, props,
id) {};

/** @deprecated */
React.findDOMNode = function(component) {};

React.cloneElement = function(element, props) {};
Expand Down

0 comments on commit bbf6f4c

Please sign in to comment.