UNPKG

nk-virtual

Version:

It is just an interface or wrapper around react library.

114 lines (95 loc) 4.65 kB
import { Component, PureComponent, createElement, Children } from 'react'; import ReactDom from 'react-dom'; import PropTypes from 'prop-types'; export { default as PropTypes } from 'prop-types'; import ReactCSSTransitionGroup from 'react-addons-css-transition-group'; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 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; } var Component$1 = function (_react$Component) { _inherits(Component$$1, _react$Component); function Component$$1(props) { _classCallCheck(this, Component$$1); return _possibleConstructorReturn(this, (Component$$1.__proto__ || Object.getPrototypeOf(Component$$1)).apply(this, arguments)); } _createClass(Component$$1, [{ key: "createdCallback", value: function createdCallback() {} }, { key: "attachedCallback", value: function attachedCallback() {} }, { key: "detachedCallback", value: function detachedCallback() {} }, { key: "attributeChangedCallback", value: function attributeChangedCallback() {} }, { key: "componentWillReceiveProps", value: function componentWillReceiveProps() { this.attributeChangedCallback.apply(this, arguments); } }, { key: "componentWillMount", value: function componentWillMount() { this.createdCallback.apply(this, arguments); } }, { key: "componentDidMount", value: function componentDidMount() { this.attachedCallback.apply(this, arguments); } }, { key: "componentWillUnmount", value: function componentWillUnmount() { this.detachedCallback.apply(this, arguments); } }]); return Component$$1; }(Component); var PureComponent$1 = function (_react$PureComponent) { _inherits(PureComponent$$1, _react$PureComponent); function PureComponent$$1(props) { _classCallCheck(this, PureComponent$$1); return _possibleConstructorReturn(this, (PureComponent$$1.__proto__ || Object.getPrototypeOf(PureComponent$$1)).apply(this, arguments)); } _createClass(PureComponent$$1, [{ key: "createdCallback", value: function createdCallback() {} }, { key: "attachedCallback", value: function attachedCallback() {} }, { key: "detachedCallback", value: function detachedCallback() {} }, { key: "attributeChangedCallback", value: function attributeChangedCallback() {} }, { key: "componentWillReceiveProps", value: function componentWillReceiveProps() { this.attributeChangedCallback.apply(this, arguments); } }, { key: "componentWillMount", value: function componentWillMount() { this.createdCallback.apply(this, arguments); } }, { key: "componentDidMount", value: function componentDidMount() { this.attachedCallback.apply(this, arguments); } }, { key: "componentWillUnmount", value: function componentWillUnmount() { this.detachedCallback.apply(this, arguments); } }]); return PureComponent$$1; }(PureComponent); var VirtualCSSTransitionGroup = ReactCSSTransitionGroup; var Virtual = { PropTypes: PropTypes, createElement: createElement, Children: Children, Component: Component$1, PureComponent: PureComponent$1 }; var VirtualDom = { render: ReactDom.render }; export { Virtual, VirtualDom, VirtualCSSTransitionGroup };