@arc-fusion/components
Advanced tools
Comparing version 3.0.0-beta.8 to 3.0.0-beta.9
{ | ||
"name": "@arc-fusion/components", | ||
"version": "3.0.0-beta.8", | ||
"version": "3.0.0-beta.9", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "src/components", |
@@ -0,3 +1,21 @@ | ||
/** | ||
* <App /> component for the Fusion rendering platform | ||
* | ||
* Properties: | ||
* children: PropTypes.node | ||
* deployment: PropTypes.oneOfType([ PropTypes.number, PropTypes.string ]) | ||
* getComponent: PropTypes.func | ||
* getContent: PropTypes.func | ||
* getState: PropTypes.func | ||
* globalContent: PropTypes.object | ||
* globalContentConfig: PropTypes.object | ||
* location: PropTypes.string | ||
* routerContext: PropTypes.object | ||
* singlePage: PropTypes.bool | ||
* tree: PropTypes.oneOfType([ PropTypes.array, PropTypes.object ]) | ||
*/ | ||
'use strict' | ||
const PropTypes = require('prop-types') | ||
const React = require('react') | ||
@@ -43,3 +61,3 @@ const { Router, StaticRouter } = require('react-router-dom') | ||
const { children, getComponent, tree } = props | ||
const { children, getComponent, globalContent, globalContentConfig, tree } = props | ||
@@ -51,2 +69,4 @@ if (!children && tree && !getComponent) { | ||
this.state = { | ||
globalContent, | ||
globalContentConfig, | ||
tree | ||
@@ -57,4 +77,8 @@ } | ||
render () { | ||
const { children, deployment, getComponent, getContent, getTree, location, routerContext, ...appContext } = this.props | ||
const { tree } = this.state | ||
const { children, deployment, getComponent, getContent, getState, location, routerContext, ...appContext } = this.props | ||
const { | ||
globalContent, | ||
globalContentConfig, | ||
tree | ||
} = this.state | ||
@@ -68,2 +92,4 @@ return React.createElement( | ||
renderables: getDescendants({ children: tree }), | ||
globalContent, | ||
globalContentConfig, | ||
tree | ||
@@ -79,6 +105,7 @@ } | ||
{ | ||
globalContent, | ||
globalContentConfig, | ||
tree, | ||
getComponent, | ||
getContent, | ||
globalContent: appContext.globalContent | ||
getContent | ||
} | ||
@@ -91,2 +118,16 @@ ) | ||
App.propTypes = { | ||
children: PropTypes.node, | ||
deployment: PropTypes.oneOfType([ PropTypes.number, PropTypes.string ]), | ||
getComponent: PropTypes.func, | ||
getContent: PropTypes.func, | ||
getState: PropTypes.func, | ||
globalContent: PropTypes.object, | ||
globalContentConfig: PropTypes.object, | ||
location: PropTypes.string, | ||
routerContext: PropTypes.object, | ||
singlePage: PropTypes.bool, | ||
tree: PropTypes.oneOfType([ PropTypes.array, PropTypes.object ]) | ||
} | ||
class ClientApp extends App { | ||
@@ -96,10 +137,10 @@ constructor (props) { | ||
const { getTree, singlePage } = props | ||
const { getState, singlePage } = props | ||
const history = createBrowserHistory({ forceRefresh: !singlePage }) | ||
if (getTree) { | ||
if (getState) { | ||
history.listen((location, action) => { | ||
getTree(location.pathname) | ||
.then((tree) => { | ||
this.setState({ tree }) | ||
getState(location.pathname) | ||
.then((state) => { | ||
this.setState(state) | ||
}) | ||
@@ -106,0 +147,0 @@ }) |
@@ -0,1 +1,10 @@ | ||
/** | ||
* <Comment /> component for Fusion rendering platform | ||
* | ||
* Creates an undisplayed div that can be created with data-* attributes and/or HTML comments via dangerouslySetInnerHTML | ||
* | ||
* Example: | ||
* <Comment data-component="my-component" data-timestamp="12345" dangerouslySetInnerHTML={{ __html: '<!-- some other message -->' }} /> | ||
*/ | ||
'use strict' | ||
@@ -9,7 +18,8 @@ | ||
{ | ||
...props, | ||
style: { | ||
...(props.style || {}), | ||
display: 'none' | ||
}, | ||
...props | ||
} | ||
} | ||
) |
@@ -47,7 +47,10 @@ 'use strict' | ||
} | ||
Content.propTypes = { | ||
children: PropTypes.oneOfType([PropTypes.func, PropTypes.arrayOf(PropTypes.func)]), | ||
filter: PropTypes.string, | ||
inherit: PropTypes.bool, | ||
query: PropTypes.object, | ||
render: PropTypes.func, | ||
source: PropTypes.string, | ||
query: PropTypes.object, | ||
filter: PropTypes.string, | ||
transform: PropTypes.func | ||
@@ -54,0 +57,0 @@ } |
'use strict' | ||
const PropTypes = require('prop-types') | ||
const React = require('react') | ||
@@ -39,2 +40,7 @@ | ||
const propTypes = { | ||
children: PropTypes.oneOfType([PropTypes.func, PropTypes.arrayOf(PropTypes.func)]), | ||
render: PropTypes.func | ||
} | ||
const Context = (useContext) => { | ||
@@ -62,2 +68,4 @@ const ContextComponent = ({ children, render, ...props }) => { | ||
ContextComponent.propTypes = propTypes | ||
ContextComponent.displayName = `${useContext.name || ''}Context` | ||
@@ -85,3 +93,7 @@ | ||
{ | ||
displayName: `with${useContext.name || ''}Context(${getComponentName(Component)})` | ||
displayName: `with${useContext.name || ''}Context(${getComponentName(Component)})`, | ||
propTypes: { | ||
...(Component.propTypes || {}), | ||
...propTypes | ||
} | ||
} | ||
@@ -88,0 +100,0 @@ ) |
'use strict' | ||
const PropTypes = require('prop-types') | ||
const React = require('react') | ||
@@ -45,2 +46,6 @@ | ||
Layout.propTypes = { | ||
children: PropTypes.node | ||
} | ||
Layout.sections = sections | ||
@@ -47,0 +52,0 @@ return Layout |
'use strict' | ||
const PropTypes = require('prop-types') | ||
const React = require('react') | ||
@@ -55,2 +56,6 @@ | ||
Quarantine.propTypes = { | ||
children: PropTypes.node | ||
} | ||
Quarantine.displayName = `Quarantine(${name})` | ||
@@ -57,0 +62,0 @@ |
@@ -115,3 +115,4 @@ 'use strict' | ||
Static.propTypes = { | ||
id: PropTypes.string.isRequired | ||
id: PropTypes.string.isRequired, | ||
children: PropTypes.node | ||
} | ||
@@ -118,0 +119,0 @@ |
'use strict' | ||
const PropTypes = require('prop-types') | ||
const React = require('react') | ||
@@ -26,5 +27,9 @@ | ||
}) | ||
: { | ||
fetched: Promise.resolve() | ||
} | ||
: (() => { | ||
const cached = new Error(`One of 'inherit' or 'source' must be provided to getContent`) | ||
return { | ||
cached, | ||
fetched: Promise.reject(cached) | ||
} | ||
})() | ||
@@ -121,2 +126,9 @@ return (config.transform) | ||
Tree.propTypes = { | ||
getComponent: PropTypes.func.isRequired, | ||
getContent: PropTypes.func, | ||
globalContent: PropTypes.object, | ||
tree: PropTypes.oneOfType([ PropTypes.array, PropTypes.object ]).isRequired | ||
} | ||
module.exports = Tree |
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
30697
1054