react-shadow
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -108,3 +108,3 @@ import React, { Component, PropTypes } from 'react'; | ||
className={name === country ? 'active' : ''} | ||
> | ||
> | ||
{name} | ||
@@ -111,0 +111,0 @@ </a> |
{ | ||
"name": "react-shadow", | ||
"version": "1.0.0", | ||
"description": "Use Shadow DOM with React.js and CSS imports; write your component styles in CSS!", | ||
"version": "1.0.1", | ||
"description": "Utilise Shadow DOM in React with all the benefits of style encapsulation.", | ||
"main": "dist/react-shadow.js", | ||
@@ -98,2 +98,2 @@ "scripts": { | ||
} | ||
} | ||
} |
@@ -21,5 +21,7 @@ ![Screenshot](media/screenshot.png) | ||
export default props => { | ||
<ShadowDOM cssDocuments={['css/core/calendar.css', props.theme]}> | ||
<h1>Calendar</h1> | ||
</ShadowDOM> | ||
return ( | ||
<ShadowDOM cssDocuments={['css/core/calendar.css', props.theme]}> | ||
<h1>Calendar</h1> | ||
</ShadowDOM> | ||
); | ||
} | ||
@@ -32,6 +34,6 @@ ``` | ||
As the CSS documents are being fetched over the network the host element will have a `className` of `resolving` for you to avoid the dreaded [FOIC](https://en.wikipedia.org/wiki/Flash_of_unstyled_content). Once **all** of the documents have been attached the `className` will change to `resolved`. | ||
As the CSS documents are being fetched over the network, the host element will have a `className` of `resolving` for you to avoid the dreaded [FOIC](https://en.wikipedia.org/wiki/Flash_of_unstyled_content). Once **all** of the documents have been attached the `className` will change to `resolved`. | ||
### Cached Documents | ||
Where components share CSS documents, only one instance of the CSS document will be fetched due to [`memoize` of the `fetchStylesheets`](https://github.com/Wildhoney/ReactShadow/blob/react-15.0/src/react-shadow.js#L22) function. | ||
Where components share CSS documents, only one instance of the CSS document will be fetched due to `memoize` of the [`fetchStylesheet`](https://github.com/Wildhoney/ReactShadow/blob/react-15.0/src/react-shadow.js#L22) function. |
@@ -40,2 +40,10 @@ import { get as fetch } from 'axios'; | ||
/** | ||
* @constant defaultProps | ||
* @type {Object} | ||
*/ | ||
static defaultProps = { | ||
cssDocuments: [] | ||
}; | ||
/** | ||
* @constructor | ||
@@ -70,3 +78,3 @@ */ | ||
const root = node.attachShadow ? node.attachShadow({ mode: 'open' }) : node.createShadowRoot(); | ||
const cssDocuments = this.props.cssDocuments || []; | ||
const cssDocuments = this.props.cssDocuments; | ||
const container = this.getContainer(); | ||
@@ -77,3 +85,3 @@ | ||
render(container, root); | ||
!cssDocuments && this.setState({ root }); | ||
cssDocuments.length === 0 && this.setState({ root }); | ||
@@ -80,0 +88,0 @@ if (cssDocuments.length) { |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
688012
1052
38