react-frame-component
Advanced tools
Comparing version 1.0.3 to 1.1.0
@@ -13,2 +13,6 @@ 'use strict'; | ||
var _propTypes = require('prop-types'); | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -20,5 +24,4 @@ | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // eslint-disable-line no-unused-vars | ||
// eslint-disable-line no-unused-vars | ||
@@ -53,10 +56,10 @@ var DocumentContext = function (_Component) { | ||
DocumentContext.propTypes = { | ||
document: _react.PropTypes.object.isRequired, | ||
window: _react.PropTypes.object.isRequired, | ||
children: _react.PropTypes.element.isRequired | ||
document: _propTypes2.default.object.isRequired, | ||
window: _propTypes2.default.object.isRequired, | ||
children: _propTypes2.default.element.isRequired | ||
}; | ||
DocumentContext.childContextTypes = { | ||
document: _react.PropTypes.object.isRequired, | ||
window: _react.PropTypes.object.isRequired | ||
document: _propTypes2.default.object.isRequired, | ||
window: _propTypes2.default.object.isRequired | ||
}; | ||
exports.default = DocumentContext; |
@@ -19,2 +19,6 @@ 'use strict'; | ||
var _propTypes = require('prop-types'); | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
var _DocumentContext = require('./DocumentContext'); | ||
@@ -171,9 +175,9 @@ | ||
Frame.propTypes = { | ||
style: _react.PropTypes.object, // eslint-disable-line | ||
head: _react.PropTypes.node, | ||
initialContent: _react.PropTypes.string, | ||
mountTarget: _react.PropTypes.string, | ||
contentDidMount: _react.PropTypes.func, | ||
contentDidUpdate: _react.PropTypes.func, | ||
children: _react.PropTypes.oneOfType([_react.PropTypes.element, _react.PropTypes.arrayOf(_react.PropTypes.element)]) | ||
style: _propTypes2.default.object, // eslint-disable-line | ||
head: _propTypes2.default.node, | ||
initialContent: _propTypes2.default.string, | ||
mountTarget: _propTypes2.default.string, | ||
contentDidMount: _propTypes2.default.func, | ||
contentDidUpdate: _propTypes2.default.func, | ||
children: _propTypes2.default.oneOfType([_propTypes2.default.element, _propTypes2.default.arrayOf(_propTypes2.default.element)]) | ||
}; | ||
@@ -180,0 +184,0 @@ Frame.defaultProps = { |
{ | ||
"name": "react-frame-component", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"description": "React component to wrap your application or component in an iFrame for encapsulation purposes", | ||
@@ -12,3 +12,3 @@ "main": "lib/index.js", | ||
"karma:once": "karma start --single-run", | ||
"karma:dev": "karma start --browsers Chrome,Electron", | ||
"karma:dev": "karma start --browsers Chrome", | ||
"babel": "babel src -d lib", | ||
@@ -49,3 +49,2 @@ "build": "npm-run-all clean babel", | ||
"chai": "^3.5.0", | ||
"electron": "^1.4.14", | ||
"eslint": "^3.13.1", | ||
@@ -59,3 +58,2 @@ "eslint-config-airbnb": "^14.0.0", | ||
"karma-chrome-launcher": "^2.0.0", | ||
"karma-electron": "^5.1.1", | ||
"karma-mocha": "^1.3.0", | ||
@@ -72,5 +70,5 @@ "karma-osx-reporter": "^0.2.1", | ||
"npm-run-all": "^4.0.1", | ||
"react": "^15.0.1", | ||
"react-addons-test-utils": "^15.0.1", | ||
"react-dom": "^15.0.1", | ||
"prop-types": "^15.5.9", | ||
"react": "^15.5.4", | ||
"react-dom": "^15.5.4", | ||
"rimraf": "^2.5.4", | ||
@@ -84,5 +82,6 @@ "sinon": "2.0.0-pre", | ||
"peerDependencies": { | ||
"react": "^15.0.1", | ||
"react-dom": "^15.0.1" | ||
"prop-types": "^15.5.9", | ||
"react": "^15.5.9", | ||
"react-dom": "^15.5.9" | ||
} | ||
} |
@@ -17,3 +17,3 @@ # React <Frame /> component | ||
Go check out the [demo] [demo-url]. | ||
Go check out the [demo][demo-url]. | ||
@@ -45,11 +45,11 @@ ```html | ||
#####Props: | ||
##### Props: | ||
######head | ||
`head: React.PropTypes.node` | ||
###### head | ||
`head: PropTypes.node` | ||
The `head` prop is a dom node that gets inserted before the children of the frame. Note that this is injected into the body of frame (see the blog post for why). This has the benefit of being able to update and works for stylesheets. | ||
######initialContent | ||
`initialContent: React.PropTypes.string` | ||
###### initialContent | ||
`initialContent: PropTypes.string` | ||
@@ -60,4 +60,4 @@ Defaults to `'<!DOCTYPE html><html><head></head><body><div></div></body></html>'` | ||
######mountTarget | ||
`mountTarget: React.PropTypes.string` | ||
###### mountTarget | ||
`mountTarget: PropTypes.string` | ||
@@ -74,5 +74,5 @@ The `mountTarget` props is a css selector (#target/.target) that specifies where in the `initialContent` of the iframe, children will be mounted. | ||
######contentDidMount and contentDidUpdate | ||
`contentDidMount: React.PropTypes.func` | ||
`contentDidUpdate: React.PropTypes.func` | ||
###### contentDidMount and contentDidUpdate | ||
`contentDidMount: PropTypes.func` | ||
`contentDidUpdate: PropTypes.func` | ||
@@ -86,6 +86,6 @@ `contentDidMount` and `contentDidUpdate` are conceptually equivalent to | ||
######Accessing the iframe's window and document | ||
###### Accessing the iframe's window and document | ||
The iframe's `window` and `document` may be accessed via the React context values `window` and `document` respectively. | ||
``` | ||
```js | ||
const MyComponent = (props, context) => { | ||
@@ -96,4 +96,6 @@ const { | ||
} = context; | ||
return (<...rendered jsx.../>); | ||
}; | ||
MyComponent.contextTypes = { | ||
@@ -107,3 +109,3 @@ window: PropTypes.any, | ||
I wrote a [blog post] [blog-url] about building this component. | ||
I wrote a [blog post][blog-url] about building this component. | ||
@@ -110,0 +112,0 @@ ## License |
@@ -1,2 +0,3 @@ | ||
import React, { Component, Children, PropTypes } from 'react'; // eslint-disable-line no-unused-vars | ||
import React, { Component, Children } from 'react'; // eslint-disable-line no-unused-vars | ||
import PropTypes from 'prop-types'; | ||
@@ -3,0 +4,0 @@ export default class DocumentContext extends Component { |
@@ -1,3 +0,4 @@ | ||
import React, { Component, PropTypes } from 'react'; | ||
import React, { Component } from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import PropTypes from 'prop-types'; | ||
import DocumentContext from './DocumentContext'; | ||
@@ -4,0 +5,0 @@ |
@@ -1,4 +0,5 @@ | ||
import React, { PropTypes } from 'react'; | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import ReactTestUtils from 'react-addons-test-utils'; | ||
import PropTypes from 'prop-types'; | ||
import ReactTestUtils from 'react-dom/test-utils'; | ||
import { expect } from 'chai'; | ||
@@ -5,0 +6,0 @@ import DocumentContext from '../src/DocumentContext'; |
@@ -1,4 +0,5 @@ | ||
import React, { PropTypes } from 'react'; | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import ReactDOM from 'react-dom'; | ||
import ReactTestUtils from 'react-addons-test-utils'; | ||
import ReactTestUtils from 'react-dom/test-utils'; | ||
import { expect } from 'chai'; | ||
@@ -5,0 +6,0 @@ import sinon from 'sinon/pkg/sinon'; |
Sorry, the diff of this file is not supported yet
37
683
121
208551
3