react-habitat
Advanced tools
Comparing version 0.4.1 to 0.4.2
## React Habitat Change log | ||
### [0.4.2] | ||
- Updated readme with TypeScript notes | ||
- Fixed issues with type script definitions [#9](https://github.com/DeloitteDigitalAPAC/react-habitat/issues/9). Thanks @aventurella | ||
### [0.4.1] | ||
@@ -4,0 +9,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("React"),require("ReactDOM")):"function"==typeof define&&define.amd?define(["React","ReactDOM"],t):"object"==typeof exports?exports.ReactHabitat=t(require("React"),require("ReactDOM")):e.ReactHabitat=t(e.React,e.ReactDOM)}(this,function(e,t){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),a=r(o),i=n(3),u=r(i),l=n(5);t.default={Bootstrapper:a.default,Container:u.default,createBootstrapper:l.createBootstrapper},e.exports=t.default},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(){},i=a,u=a,l="http://tinyurl.com/jxryd3s",c=function(){function e(){r(this,e)}return o(e,null,[{key:"warn",value:function(e,t){var n=u("WARNING: "+e+" "+t+" "+l+"#"+e.toLowerCase(),arguments);i("warn",n)}},{key:"error",value:function(e,t){var n=u("ERROR: "+e+" "+t+" "+l+"#"+e.toLowerCase(),arguments);i("error",n)}}]),e}();t.default=c,e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t,n){for(var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=e.domFactory(),a=e.id(),i=0;t.length>i;++i){var u=t[i],c=u.getAttribute(n),f=e.resolve(c);f?(u.querySelector("["+n+"]")&&s.default.warn("RHW08","Component should not contain any nested components.",u),o.inject(f,l.default.parseProps(u),l.default.create(u,a))):s.default.error("RHW01",'Cannot resolve component "'+c+'" for element.',u)}"function"==typeof r&&r.call()}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(4),l=r(u),c=n(1),s=r(c),f="data-component",d=function(){function e(){if(o(this,e),!window||!window&&!window.document)throw Error("React Habitat requires a window but cannot see one :(");this.componentSelector=f,this._elements=null,this._container=null}return i(e,[{key:"setContainer",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return null!==this._container?void s.default.error("RHW02","A container is already set. Please call dispose() before assigning a new one."):(this._container=e,this._elements=window.document.body.querySelectorAll("["+this.componentSelector+"]"),void a(this._container,this._elements,this.componentSelector,t))}},{key:"dispose",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=this._container.domFactory(),n=window.document.body.querySelectorAll('[data-habitat="'+this._container.id()+'"]'),r=0;n.length>r;++r)t.dispose(n[r]),l.default.destroy(n[r]);this._container=null,this._elements=null,"function"==typeof e&&e.call()}}]),e}();t.default=d,e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(6),l=r(u),c=n(1),s=r(c),f=function(){var e=0;return function(){return e++,"C"+e}}(),d=function(){function e(){o(this,e),this._components={},this._id=f()}return i(e,[{key:"id",value:function(){return this._id}},{key:"register",value:function(e,t){if("string"!=typeof e)throw Error("Unexpected component key. Expects a string.",e);this._components[e]=t}},{key:"registerAll",value:function(e){if("object"!==(void 0===e?"undefined":a(e)))throw Error("Unexpected components type. Expects type object",e);Object.assign(this._components,e)}},{key:"resolve",value:function(e){return this._components[e]}},{key:"domFactory",value:function(){return l.default}},{key:"registerComponent",value:function(e,t){s.default.warn("RHW03",'registerComponent is being deprecated. Please use "register" instead.'),this.register(e,t)}},{key:"registerComponents",value:function(e){s.default.warn("RHW03",'registerComponents is being deprecated. Please use "registerAll" instead.'),this.registerAll(e)}},{key:"getComponent",value:function(e){return s.default.warn("RHW03",'getComponent is being deprecated. Please use "resolve" instead.'),this.resolve(e)}}]),e}();t.default=d,e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e){var t=e.currentStyle||window.getComputedStyle(e,"");return t.display}function i(e){return e[1].toUpperCase()}function u(e,t){return t.replace(e,"").replace(/-([a-z])/g,i)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(1),s=r(c),f="habitatHostElement",d="data-habitat",p="data-has-habitat",y="data-prop-",b="data-props",v="data-n-prop-",h="data-r-prop-",m=!1,w=function(){function e(){o(this,e)}return l(e,null,[{key:"parseProps",value:function(e){for(var t={proxy:e},n=0;e.attributes.length>n;n++){var r=e.attributes[n];if(0===r.name.indexOf(y)){var o=u(y,r.name),a=r.value||"";"string"==typeof a&&"false"===a.toLowerCase()&&(a=!1),"string"==typeof a&&"true"===a.toLowerCase()&&(a=!0),"string"==typeof a&&a.length>=2&&("{"===a[0]&&"}"===a[a.length-1]||"["===a[0]&&"]"===a[a.length-1])&&(a=JSON.parse(a)),"string"==typeof a&&"null"===a.toLowerCase()&&(a=null),t[o]=a}else if(r.name===b)Object.assign(t,JSON.parse(r.value));else if(0===r.name.indexOf("data-n-prop-")){var i=u(v,r.name);t[i]=parseFloat(r.value)}else if(window&&0===r.name.indexOf(h)){var l=u(h,r.name);t[l]=window[r.value]}}return t}},{key:"create",value:function(e,t){if(window.document.body===e||null===e||void 0===e)return s.default.warn("RHW04","Cannot open a habitat for element.",e),null;var n="span";"block"===a(e)&&(n="div");var r=window.document.createElement(n),o=e.getAttribute("data-habitat-class")||null,i=!1;if(null!==e.getAttribute("data-habitat-no-replace")&&(i="true"===e.getAttribute("data-habitat-no-replace").toLocaleLowerCase()),r.setAttribute(d,t),o&&(r.className=""+o),e.parentNode.insertBefore(r,e.nextSibling),"INPUT"!==e.tagName){if(!i){var u=e.parentNode.removeChild(e);try{r[f]=u}catch(e){m&&(s.default.warn("RHW06","Arbitrary properties are disabled. The container may not dispose correctly.",e),m=!0)}}}else e.setAttribute(p,"true"),"hidden"!==e.getAttribute("type")&&e.setAttribute("style","display: none;");return r}},{key:"hasHabitat",value:function(e){return null!==e.getAttribute(p)}},{key:"destroy",value:function(e){try{void 0!==e[f]&&e.parentNode.insertBefore(e[f],e)}finally{e.parentNode.removeChild(e)}}}]),e}();t.default=w,e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function u(e){return new d(e)}Object.defineProperty(t,"__esModule",{value:!0}),t._Mixin=void 0,t.createBootstrapper=u;var l=n(2),c=r(l),s=n(3),f=r(s),d=t._Mixin=function(e){function t(e){o(this,t);var n=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));if(!e.container)return console.warn('"Container" property was not supplied'),a(n);e.componentSelector&&(n.componentSelector=e.componentSelector);for(var r=new f.default,i=0;e.container.length>i;i++)r.register(e.container[i].register,e.container[i].for);return n.setContainer(r),n}return i(t,e),t}(c.default)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(7),u=r(i),l=n(8),c=r(l),s=n(1),f=r(s),d=function(){function e(){o(this,e)}return a(e,null,[{key:"inject",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments[2];n?c.default.render(u.default.createElement(e,t||{}),n):f.default.warn("RHW07","Target element is null or undefined.")}},{key:"dispose",value:function(e){e&&c.default.unmountComponentAtNode(e)}}]),e}();t.default=d,e.exports=t.default},function(t,n){t.exports=e},function(e,n){e.exports=t}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("React"),require("ReactDOM")):"function"==typeof define&&define.amd?define(["React","ReactDOM"],t):"object"==typeof exports?exports.ReactHabitat=t(require("React"),require("ReactDOM")):e.ReactHabitat=t(e.React,e.ReactDOM)}(this,function(e,t){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),a=r(o),i=n(3),u=r(i),l=n(5);t.default={Bootstrapper:a.default,Container:u.default,createBootstrapper:l.createBootstrapper},e.exports=t.default},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(){},i=a,u=a,l="http://tinyurl.com/jxryd3s",c=function(){function e(){r(this,e)}return o(e,null,[{key:"warn",value:function(e,t){var n=u("WARNING: "+e+" "+t+" "+l+"#"+e.toLowerCase(),arguments);i("warn",n)}},{key:"error",value:function(e,t){var n=u("ERROR: "+e+" "+t+" "+l+"#"+e.toLowerCase(),arguments);i("error",n)}}]),e}();t.default=c,e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t,n){for(var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=e.domFactory(),a=e.id(),i=0;t.length>i;++i){var u=t[i],c=u.getAttribute(n),f=e.resolve(c);f?(u.querySelector("["+n+"]")&&s.default.warn("RHW08","Component should not contain any nested components.",u),o.inject(f,l.default.parseProps(u),l.default.create(u,a))):s.default.error("RHW01",'Cannot resolve component "'+c+'" for element.',u)}"function"==typeof r&&r.call()}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(4),l=r(u),c=n(1),s=r(c),f="data-component",d=function(){function e(){if(o(this,e),!window||!window&&!window.document)throw Error("React Habitat requires a window but cannot see one :(");this.componentSelector=f,this._elements=null,this._container=null}return i(e,[{key:"setContainer",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return null!==this._container?void s.default.error("RHW02","A container is already set. Please call dispose() before assigning a new one."):(this._container=e,this._elements=window.document.body.querySelectorAll("["+this.componentSelector+"]"),void a(this._container,this._elements,this.componentSelector,t))}},{key:"dispose",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=this._container.domFactory(),n=window.document.body.querySelectorAll('[data-habitat="'+this._container.id()+'"]'),r=0;n.length>r;++r)t.dispose(n[r]),l.default.destroy(n[r]);this._container=null,this._elements=null,"function"==typeof e&&e.call()}}]),e}();t.default=d,e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(6),l=r(u),c=n(1),s=r(c),f=function(){var e=0;return function(){return e++,"C"+e}}(),d=function(){function e(){o(this,e),this._components={},this._id=f()}return i(e,[{key:"id",value:function(){return this._id}},{key:"register",value:function(e,t){if("string"!=typeof e)throw Error("Unexpected component key. Expects a string.",e);this._components[e]=t}},{key:"registerAll",value:function(e){if("object"!==(void 0===e?"undefined":a(e)))throw Error("Unexpected components type. Expects type object",e);Object.assign(this._components,e)}},{key:"resolve",value:function(e){return this._components[e]}},{key:"domFactory",value:function(){return l.default}},{key:"registerComponent",value:function(e,t){s.default.warn("RHW03",'registerComponent is being deprecated. Please use "register" instead.'),this.register(e,t)}},{key:"registerComponents",value:function(e){s.default.warn("RHW03",'registerComponents is being deprecated. Please use "registerAll" instead.'),this.registerAll(e)}},{key:"getComponent",value:function(e){return s.default.warn("RHW03",'getComponent is being deprecated. Please use "resolve" instead.'),this.resolve(e)}}]),e}();t.default=d,e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e){var t=e.currentStyle||window.getComputedStyle(e,"");return t.display}function i(e){return e[1].toUpperCase()}function u(e,t){return t.replace(e,"").replace(/-([a-z])/g,i)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(1),s=r(c),f="habitatHostElement",d="data-habitat",p="data-has-habitat",y="data-prop-",b="data-props",v="data-n-prop-",h="data-r-prop-",m=!1,w=function(){function e(){o(this,e)}return l(e,null,[{key:"parseProps",value:function(e){for(var t={proxy:e},n=0;e.attributes.length>n;n++){var r=e.attributes[n];if(0===r.name.indexOf(y)){var o=u(y,r.name),a=r.value||"";"string"==typeof a&&"false"===a.toLowerCase()&&(a=!1),"string"==typeof a&&"true"===a.toLowerCase()&&(a=!0),"string"==typeof a&&a.length>=2&&("{"===a[0]&&"}"===a[a.length-1]||"["===a[0]&&"]"===a[a.length-1])&&(a=JSON.parse(a)),"string"==typeof a&&"null"===a.toLowerCase()&&(a=null),t[o]=a}else if(r.name===b)Object.assign(t,JSON.parse(r.value));else if(0===r.name.indexOf("data-n-prop-")){var i=u(v,r.name);t[i]=parseFloat(r.value)}else if(window&&0===r.name.indexOf(h)){var l=u(h,r.name);t[l]=window[r.value]}}return t}},{key:"create",value:function(e,t){if(window.document.body===e||null===e||void 0===e)return s.default.warn("RHW04","Cannot open a habitat for element.",e),null;var n="span";"block"===a(e)&&(n="div");var r=window.document.createElement(n),o=e.getAttribute("data-habitat-class")||null,i=!1;if(null!==e.getAttribute("data-habitat-no-replace")&&(i="true"===e.getAttribute("data-habitat-no-replace").toLocaleLowerCase()),r.setAttribute(d,t),o&&(r.className=""+o),e.parentNode.insertBefore(r,e.nextSibling),"INPUT"!==e.tagName){if(!i){var u=e.parentNode.removeChild(e);try{r[f]=u}catch(l){m&&(s.default.warn("RHW06","Arbitrary properties are disabled. The container may not dispose correctly.",l),m=!0)}}}else e.setAttribute(p,"true"),"hidden"!==e.getAttribute("type")&&e.setAttribute("style","display: none;");return r}},{key:"hasHabitat",value:function(e){return null!==e.getAttribute(p)}},{key:"destroy",value:function(e){try{void 0!==e[f]&&e.parentNode.insertBefore(e[f],e)}finally{e.parentNode.removeChild(e)}}}]),e}();t.default=w,e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function u(e){return new d(e)}Object.defineProperty(t,"__esModule",{value:!0}),t._Mixin=void 0,t.createBootstrapper=u;var l=n(2),c=r(l),s=n(3),f=r(s),d=t._Mixin=function(e){function t(e){o(this,t);var n=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));if(!e.container)return console.warn('"Container" property was not supplied'),a(n);e.componentSelector&&(n.componentSelector=e.componentSelector);for(var r=new f.default,i=0;e.container.length>i;i++)r.register(e.container[i].register,e.container[i].for);return n.setContainer(r),n}return i(t,e),t}(c.default)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(7),u=r(i),l=n(8),c=r(l),s=n(1),f=r(s),d=function(){function e(){o(this,e)}return a(e,null,[{key:"inject",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments[2];n?c.default.render(u.default.createElement(e,t||{}),n):f.default.warn("RHW07","Target element is null or undefined.")}},{key:"dispose",value:function(e){e&&c.default.unmountComponentAtNode(e)}}]),e}();t.default=d,e.exports=t.default},function(t,n){t.exports=e},function(e,n){e.exports=t}])}); |
112
index.d.ts
@@ -9,70 +9,69 @@ /** | ||
export interface IDomFactory { | ||
declare module "react-habitat" { | ||
/** | ||
* The inject method after a wire-up has been requested | ||
* @param {*} module - The component | ||
* @param {object} props - The components properties | ||
* @param {Element} target - The element to inject the component into | ||
*/ | ||
inject: (module: any, props: {}, target: Element) => void; | ||
interface IDomFactory { | ||
/** | ||
* The dispose method | ||
* @param {Element} target - The element to dispose | ||
*/ | ||
dispose: (target: Element) => void; | ||
} | ||
/** | ||
* The inject method after a wire-up has been requested | ||
* @param {*} module - The component | ||
* @param {object} props - The components properties | ||
* @param {Element} target - The element to inject the component into | ||
*/ | ||
inject: (module: any, props: {}, target: Element) => void; | ||
export interface IContainer { | ||
/** | ||
* The dispose method | ||
* @param {Element} target - The element to dispose | ||
*/ | ||
dispose: (target: Element) => void; | ||
} | ||
/** | ||
* Register a new component in the container | ||
* @param {string} name - The key that identifies this component | ||
* @param {*} comp - The component class | ||
*/ | ||
register: (name: string, comp: any) => void; | ||
interface IContainer { | ||
/** | ||
* Register multiple components in the container | ||
* @param {object} comps - The components | ||
*/ | ||
registerAll: (comps: {}) => void; | ||
/** | ||
* Register a new component in the container | ||
* @param {string} name - The key that identifies this component | ||
* @param {*} comp - The component class | ||
*/ | ||
register: (name: string, comp: any) => void; | ||
/** | ||
* Get a registered component for a key | ||
* @param {string} name - The key name of the component that has been registered | ||
*/ | ||
resolve: (name: string) => any; | ||
/** | ||
* Register multiple components in the container | ||
* @param {object} comps - The components | ||
*/ | ||
registerAll: (comps: {}) => void; | ||
/** | ||
* The container's unique id | ||
*/ | ||
id: () => string; | ||
/** | ||
* Get a registered component for a key | ||
* @param {string} name - The key name of the component that has been registered | ||
*/ | ||
resolve: (name: string) => any; | ||
/** | ||
* The containers dom factory | ||
*/ | ||
domFactory: () => IDomFactory; | ||
} | ||
/** | ||
* The container's unique id | ||
*/ | ||
id: () => string; | ||
export interface IBootstrapper { | ||
/** | ||
* The containers dom factory | ||
*/ | ||
domFactory: () => IDomFactory; | ||
} | ||
/** | ||
* Set the container | ||
* @param {IContainer} container - The container | ||
*/ | ||
setContainer: (container: IContainer) => void; | ||
interface IBootstrapper { | ||
/** | ||
* Dispose of the container | ||
*/ | ||
dispose: () => void; | ||
} | ||
/** | ||
* Set the container | ||
* @param {IContainer} container - The container | ||
*/ | ||
setContainer: (container: IContainer) => void; | ||
/** | ||
* Dispose of the container | ||
*/ | ||
dispose: () => void; | ||
} | ||
declare module ReactHabitat { | ||
class Bootstrapper implements IBootstrapper { | ||
export class Bootstrapper implements IBootstrapper { | ||
/** | ||
@@ -99,3 +98,3 @@ * Sets the container | ||
export class Container implements IContainer { | ||
class Container implements IContainer { | ||
@@ -127,5 +126,2 @@ /** | ||
} | ||
} | ||
export default ReactHabitat; |
{ | ||
"name": "react-habitat", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "A React DOM Bootstrapper designed to harmonise a hybrid application", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
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
121594
14
1510
449