Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@arc-fusion/components

Package Overview
Dependencies
Maintainers
10
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arc-fusion/components - npm Package Compare versions

Comparing version 3.0.0-beta.5 to 3.0.0-beta.6

layout.js

2

package.json
{
"name": "@arc-fusion/components",
"version": "3.0.0-beta.5",
"version": "3.0.0-beta.6",
"description": "",

@@ -5,0 +5,0 @@ "main": "src/components/index.js",

@@ -21,3 +21,3 @@ 'use strict'

if (isClient) {
if (isClient && fetched) {
fetched.then(setContent)

@@ -24,0 +24,0 @@ }

@@ -14,3 +14,3 @@ 'use strict'

function useAppContext () {
const appContext = React.useContext(AppContext)
const { staticElements, ...appContext } = React.useContext(AppContext)
const { globalContent } = useComponentContext()

@@ -17,0 +17,0 @@

@@ -6,4 +6,7 @@ 'use strict'

Comment: require('./comment'),
Consumer: require('./consumer'),
Content: require('./content'),
Context: require('./context')
Context: require('./context'),
Layout: require('./layout'),
Static: require('./static')
}

@@ -7,3 +7,3 @@ 'use strict'

const { isClient, getComponentName } = require('../utils')
const { getComponentName, isServer } = require('../utils')

@@ -23,34 +23,41 @@ // this extracts an already-wrapped component name

const Quarantine =
(ErrorComponent) => (isClient)
? (Component, name) => {
name = name || getName(Component)
(ErrorComponent) =>
(isServer)
? (Component) => Component
: (Component, name) => {
name = name || getName(Component)
class Quarantine extends React.Component {
constructor (props) {
super(props)
class Quarantine extends React.Component {
constructor (props) {
super(props)
this.state = {
error: null
this.state = {
error: null
}
}
}
componentDidCatch (error, info) {
console.error(error, info)
this.setState({ error })
}
componentDidCatch (error, info) {
console.error(error, info)
this.setState({ error })
}
render () {
return (this.state.error)
? React.createElement(ErrorComponent || DefaultErrorComponent, { error: this.state.error, name })
: React.createElement(Component, this.props)
render () {
const props = (Component === React.Fragment)
? {
key: this.props.key,
children: this.props.children
}
: this.props
return (this.state.error)
? React.createElement(ErrorComponent, { error: this.state.error, name })
: React.createElement(Component, props)
}
}
}
Quarantine.displayName = `Quarantine(${name})`
Quarantine.displayName = `Quarantine(${name})`
return Quarantine
}
: (Component) => Component
return Quarantine
}
module.exports = Quarantine(DefaultErrorComponent)
module.exports.Quarantine = Quarantine

@@ -5,2 +5,3 @@ 'use strict'

const Layout = require('./layout')
const Quarantine = require('./quarantine')

@@ -51,3 +52,6 @@

const Component = getComponent(node)
collectionCache[type] = Component && Quarantine(Component)
const Wrapper = (collection === 'layouts')
? Layout
: Quarantine
collectionCache[type] = Component && Wrapper(Component)
}

@@ -74,3 +78,3 @@ return collectionCache[type]

const id = node.fingerprint || node.id || node._id
const key = node.key || id
const key = node.key || id || index

@@ -102,3 +106,5 @@ const getComponentContent = (localEdits)

Component,
node.props || {},
(Component === React.Fragment)
? { key }
: node.props || {},
(children instanceof Object)

@@ -105,0 +111,0 @@ ? [].concat(children).map(createElement)

@@ -10,3 +10,6 @@ 'use strict'

renderables: null,
tree: null
tree: null,
/* hidden from users */
staticElements: {}
})

@@ -20,4 +23,5 @@ AppContext.displayName = 'AppContext'

globalContent: {},
// localEdits: null,
getContent: () => {}
/* hidden from users */
getContent: () => ({})
})

@@ -24,0 +28,0 @@ ComponentContext.displayName = 'ComponentContext'

@@ -9,2 +9,3 @@ 'use strict'

const isClient = typeof window !== 'undefined'
const isServer = !isClient
const isFusion = typeof Fusion !== 'undefined'

@@ -23,3 +24,4 @@ const isFunction = (Component) => (Component instanceof Function)

isClient,
isFunction
isFunction,
isServer
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc