@cerebral/inferno
Advanced tools
Comparing version 4.0.0-1514099265786 to 4.0.0-1519463520217
@@ -1,12 +0,52 @@ | ||
import { InfernoChildren } from 'inferno'; | ||
import { InfernoChildren, VNode, Component } from 'inferno'; | ||
import { BaseControllerClass, Sequence } from 'cerebral' | ||
export function StateContainer(opts: any): any | ||
// TODO: Replace these type with Inferno JSX support | ||
type ComponentState = {}; | ||
type Validator<T> = (object: T, key: string, componentName: string, ...rest: any[]) => Error | null; | ||
type ValidationMap<T> = {[K in keyof T]?: Validator<T> }; | ||
export interface ContainerInterface { | ||
getChildContext(): any | ||
render(): InfernoChildren | ||
interface ComponentClass<P = {}> { | ||
new (props?: P, context?: any): Component<P, ComponentState>; | ||
propTypes?: ValidationMap<P>; | ||
contextTypes?: ValidationMap<any>; | ||
childContextTypes?: ValidationMap<any>; | ||
defaultProps?: Partial<P>; | ||
displayName?: string; | ||
} | ||
export function Container(opts: any): any | ||
export function connect(props: any, comp: (props: any) => void): any | ||
export function connect(props: any, comp: any): any | ||
interface InfernoJSXElement<P> extends VNode {} | ||
interface StatelessComponent<P = {}> { | ||
(props: P & { children?: InfernoChildren }, context?: any): InfernoJSXElement<any> | null; | ||
propTypes?: ValidationMap<P>; | ||
contextTypes?: ValidationMap<any>; | ||
defaultProps?: Partial<P>; | ||
displayName?: string; | ||
} | ||
type ComponentType<P = {}> = ComponentClass<P> | StatelessComponent<P>; | ||
declare global { | ||
namespace JSX { | ||
interface Element extends InfernoJSXElement<any> {} | ||
interface IntrinsicElements { | ||
[elemName: string]: any; | ||
} | ||
} | ||
} | ||
// TODO: expose SignalsMap from cerebral | ||
interface SignalsMap { | ||
[signalName: string]: Sequence | ||
} | ||
export const StateContainer: ComponentClass<{state: any, signals: SignalsMap}> | ||
export const Container: ComponentClass<{controller: BaseControllerClass}> | ||
type PropsMap<T> = { | ||
[P in keyof T]: any; // TODO: use correct type than Tag<any> | ||
} | ||
// Props are signal/state props, EProps are external props | ||
export function connect<Props, EProps = {}>(props: Props, comp: ComponentType<PropsMap<Props> & EProps>): ComponentClass<EProps> |
@@ -9,10 +9,6 @@ 'use strict'; | ||
var _infernoComponent = require('inferno-component'); | ||
var _inferno = require('inferno'); | ||
var _infernoComponent2 = _interopRequireDefault(_infernoComponent); | ||
var _cerebral = require('cerebral'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -52,5 +48,5 @@ | ||
return Container; | ||
}(_infernoComponent2.default); | ||
}(_inferno.Component); | ||
exports.default = Container; | ||
//# sourceMappingURL=Container.js.map |
@@ -11,14 +11,8 @@ 'use strict'; | ||
var _infernoComponent = require('inferno-component'); | ||
var _inferno = require('inferno'); | ||
var _infernoComponent2 = _interopRequireDefault(_infernoComponent); | ||
var _infernoCreateElement = require('inferno-create-element'); | ||
var _infernoCreateElement2 = _interopRequireDefault(_infernoCreateElement); | ||
var _cerebral = require('cerebral'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -39,3 +33,3 @@ | ||
if (!controller) { | ||
(0, _cerebral.throwError)('Can not find controller, did you remember to use the Container component? Read more at: http://cerebraljs.com/docs/api/components.html#inferno'); | ||
(0, _cerebral.throwError)('Can not find controller, did you remember to use the Container component? Read more at: https://cerebraljs.com/docs/views/inferno.html'); | ||
} | ||
@@ -62,4 +56,4 @@ | ||
_createClass(BaseComponent, [{ | ||
key: 'componentWillMount', | ||
value: function componentWillMount() { | ||
key: 'componentDidMount', | ||
value: function componentDidMount() { | ||
this.view.mount(); | ||
@@ -114,3 +108,3 @@ } | ||
return BaseComponent; | ||
}(_infernoComponent2.default); | ||
}(_inferno.Component); | ||
@@ -135,3 +129,3 @@ function HOC(dependencies, mergeProps, Component) { | ||
value: function render() { | ||
return (0, _infernoCreateElement2.default)(Component, this.view.getProps(this.props)); | ||
return (0, _infernoCreateElement.createElement)(Component, this.view.getProps(this.props)); | ||
} | ||
@@ -138,0 +132,0 @@ }]); |
@@ -9,10 +9,6 @@ 'use strict'; | ||
var _infernoComponent = require('inferno-component'); | ||
var _inferno = require('inferno'); | ||
var _infernoComponent2 = _interopRequireDefault(_infernoComponent); | ||
var _cerebral = require('cerebral'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -48,5 +44,5 @@ | ||
return StateContainer; | ||
}(_infernoComponent2.default); | ||
}(_inferno.Component); | ||
exports.default = StateContainer; | ||
//# sourceMappingURL=StateContainer.js.map |
{ | ||
"name": "@cerebral/inferno", | ||
"version": "4.0.0-1514099265786", | ||
"version": "4.0.0-1519463520217", | ||
"description": "Inferno view for Cerebral", | ||
@@ -16,7 +16,5 @@ "main": "index.js", | ||
"homepage": "http://cerebral.github.io/cerebral-website", | ||
"devDependencies": { | ||
"babel-plugin-inferno": "^3.2.0" | ||
}, | ||
"devDependencies": {}, | ||
"dependencies": { | ||
"cerebral": "^5.0.0-1514099265786" | ||
"cerebral": "^5.0.0-1519463520217" | ||
}, | ||
@@ -27,3 +25,3 @@ "scripts": { | ||
"prepublish": "npm run build", | ||
"test": "mocha -r test/setup --compilers js:babel-register \"src/**/*.test.js\"", | ||
"test": "mocha -r test/setup --compilers js:babel-register \"src/**/*.test.js\" \"test/**/*.test.js\"", | ||
"test:watch": "npm run test -- --watch" | ||
@@ -30,0 +28,0 @@ }, |
@@ -7,7 +7,7 @@ # @cerebral/inferno | ||
`npm install @cerebral/inferno inferno inferno-component inferno-create-element babel-plugin-inferno` | ||
`npm install @cerebral/inferno inferno babel-plugin-inferno` | ||
## Container | ||
```js | ||
import Inferno from 'inferno' | ||
import { render } from 'inferno' | ||
import {Controller} from 'cerebral' | ||
@@ -26,3 +26,3 @@ import {Container} from '@cerebral/inferno' | ||
Inferno.render(( | ||
render(( | ||
<Container controller={controller}> | ||
@@ -36,4 +36,3 @@ <App /> | ||
```js | ||
import Inferno from 'inferno' | ||
import Component from 'inferno-component' | ||
import { Component } from 'inferno' | ||
import {connect} from '@cerebral/inferno' | ||
@@ -40,0 +39,0 @@ import {state, signal} from 'cerebral/tags' |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
23307
0
280
60