Comparing version 0.0.6 to 0.0.7
@@ -187,3 +187,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
var name = instance._name; | ||
instance.destroy(); | ||
instance.unmount(); | ||
element['__gia_component__'] = null; | ||
@@ -190,0 +190,0 @@ if (_config2.default.get('log')) { |
@@ -1,1 +0,1 @@ | ||
(function e(t,n){if(typeof exports==="object"&&typeof module==="object")module.exports=n();else if(typeof define==="function"&&define.amd)define([],n);else if(typeof exports==="object")exports["destroyInstance"]=n();else t["destroyInstance"]=n()})(window,function(){return function(e){var t={};function n(r){if(t[r]){return t[r].exports}var o=t[r]={i:r,l:false,exports:{}};e[r].call(o.exports,o,o.exports,n);o.l=true;return o.exports}n.m=e;n.c=t;n.d=function(e,t,r){if(!n.o(e,t)){Object.defineProperty(e,t,{configurable:false,enumerable:true,get:r})}};n.r=function(e){Object.defineProperty(e,"__esModule",{value:true})};n.n=function(e){var t=e&&e.__esModule?function t(){return e["default"]}:function t(){return e};n.d(t,"a",t);return t};n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};n.p="";return n(n.s=3)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}return function(t,n,r){if(n)e(t.prototype,n);if(r)e(t,r);return t}}();function o(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}var u=function(){function e(){o(this,e);this._options={log:true}}r(e,[{key:"set",value:function e(t,n){this._options[t]=n}},{key:"get",value:function e(t){return this._options[t]}}]);return e}();t.default=new u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=r;function r(e){if(typeof e==="string"){e=document.getElementById(e);if(!e){return null}}return e["__gia_component__"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=a;var r=n(1);var o=i(r);var u=n(0);var f=i(u);function i(e){return e&&e.__esModule?e:{default:e}}function a(e){var t=(0,o.default)(e);if(t){var n=t._name;t.destroy();e["__gia_component__"]=null;if(f.default.get("log")){console.info('Removed component "'+n+'".')}}}},function(e,t,n){"use strict";var r=n(2);var o=u(r);function u(e){return e&&e.__esModule?e:{default:e}}e.exports=o.default}])}); | ||
(function e(t,n){if(typeof exports==="object"&&typeof module==="object")module.exports=n();else if(typeof define==="function"&&define.amd)define([],n);else if(typeof exports==="object")exports["destroyInstance"]=n();else t["destroyInstance"]=n()})(window,function(){return function(e){var t={};function n(r){if(t[r]){return t[r].exports}var o=t[r]={i:r,l:false,exports:{}};e[r].call(o.exports,o,o.exports,n);o.l=true;return o.exports}n.m=e;n.c=t;n.d=function(e,t,r){if(!n.o(e,t)){Object.defineProperty(e,t,{configurable:false,enumerable:true,get:r})}};n.r=function(e){Object.defineProperty(e,"__esModule",{value:true})};n.n=function(e){var t=e&&e.__esModule?function t(){return e["default"]}:function t(){return e};n.d(t,"a",t);return t};n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};n.p="";return n(n.s=3)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}return function(t,n,r){if(n)e(t.prototype,n);if(r)e(t,r);return t}}();function o(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}var u=function(){function e(){o(this,e);this._options={log:true}}r(e,[{key:"set",value:function e(t,n){this._options[t]=n}},{key:"get",value:function e(t){return this._options[t]}}]);return e}();t.default=new u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=r;function r(e){if(typeof e==="string"){e=document.getElementById(e);if(!e){return null}}return e["__gia_component__"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=a;var r=n(1);var o=i(r);var u=n(0);var f=i(u);function i(e){return e&&e.__esModule?e:{default:e}}function a(e){var t=(0,o.default)(e);if(t){var n=t._name;t.unmount();e["__gia_component__"]=null;if(f.default.get("log")){console.info('Removed component "'+n+'".')}}}},function(e,t,n){"use strict";var r=n(2);var o=u(r);function u(e){return e&&e.__esModule?e:{default:e}}e.exports=o.default}])}); |
@@ -601,3 +601,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
var name = instance._name; | ||
instance.destroy(); | ||
instance.unmount(); | ||
element['__gia_component__'] = null; | ||
@@ -604,0 +604,0 @@ if (_config2.default.get('log')) { |
@@ -1,1 +0,1 @@ | ||
(function e(t,n){if(typeof exports==="object"&&typeof module==="object")module.exports=n();else if(typeof define==="function"&&define.amd)define([],n);else if(typeof exports==="object")exports["gia"]=n();else t["gia"]=n()})(window,function(){return function(e){var t={};function n(r){if(t[r]){return t[r].exports}var o=t[r]={i:r,l:false,exports:{}};e[r].call(o.exports,o,o.exports,n);o.l=true;return o.exports}n.m=e;n.c=t;n.d=function(e,t,r){if(!n.o(e,t)){Object.defineProperty(e,t,{configurable:false,enumerable:true,get:r})}};n.r=function(e){Object.defineProperty(e,"__esModule",{value:true})};n.n=function(e){var t=e&&e.__esModule?function t(){return e["default"]}:function t(){return e};n.d(t,"a",t);return t};n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};n.p="";return n(n.s=9)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}return function(t,n,r){if(n)e(t.prototype,n);if(r)e(t,r);return t}}();function o(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}var i=function(){function e(){o(this,e);this._options={log:true}}r(e,[{key:"set",value:function e(t,n){this._options[t]=n}},{key:"get",value:function e(t){return this._options[t]}}]);return e}();t.default=new i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=r;function r(e){if(typeof e==="string"){e=document.getElementById(e);if(!e){return null}}return e["__gia_component__"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.query=r;t.queryAll=o;t.toggleClass=i;t.removeClass=u;t.addClass=a;t.triggerEvent=f;function r(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:document;if(typeof e!=="string"){return e}return t.querySelector(e)}function o(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:document;if(typeof e!=="string"){return e}return Array.prototype.slice.call(t.querySelectorAll(e))}function i(e,t){var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;if(n===null){if(e.classList.contains(t)){e.classList.remove(t)}else{e.classList.add(t)}}else{if(n){e.classList.add(t)}else{e.classList.remove(t)}}}function u(e,t){if(Array.isArray(e)){e.forEach(function(e){return e.classList.remove(t)})}else{e.classList.remove(t)}return e}function a(e,t){if(Array.isArray(e)){e.forEach(function(e){return e.classList.add(t)})}else{e.classList.add(t)}return e}function f(e,t){var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;var r=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{bubbles:true,cancelable:true,detail:null};r.detail=n;var o=new CustomEvent(t,r);e.dispatchEvent(o)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}return function(t,n,r){if(n)e(t.prototype,n);if(r)e(t,r);return t}}();var o=n(0);var i=u(o);function u(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}var f=function(){function e(){a(this,e);this.list={}}r(e,[{key:"emit",value:function e(t){var n=this;var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};r._name=t;if(this.list[t]){if(i.default.get("log")){console.info(this.list[t].length+" handler"+(this.list[t].length>1?"s":"")+" called on event '"+t+"'")}this.list[t].forEach(function(e){e.handler(r);if(e.once){n.off(t,e.handler)}})}else{if(i.default.get("log")){console.info("0 handlers called on event '"+t+"'")}}}},{key:"on",value:function e(t,n){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;if(this.list[t]){this.list[t].push({once:r,handler:n})}else{this.list[t]=[];this.list[t].push({once:r,handler:n})}}},{key:"once",value:function e(t,n){this.on(t,n,true)}},{key:"off",value:function e(t,n){if(t!=null){if(n!=null){if(this.list[t]&&this.list[t].filter(function(e){return e.handler===n}).length){var r=this.list[t].filter(function(e){return e.handler===n})[0];var o=this.list[t].indexOf(r);if(o>-1){this.list[t].splice(o,1)}}else{console.warn("Event "+t+" cannot be unsubscribed - does not exist.")}}else{this.list[t]=[]}}else{this.list={}}}}]);return e}();t.default=new f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n){if(Object.prototype.hasOwnProperty.call(n,r)){e[r]=n[r]}}}return e};var o=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol==="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}return function(t,n,r){if(n)e(t.prototype,n);if(r)e(t,r);return t}}();var u=n(2);function a(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}var f=function(){function e(t,n){a(this,e);this.element=t;this.element["__gia_component__"]=this;this._ref={};this._options=n||{};this._state={}}i(e,[{key:"_load",value:function e(){this.mount()}},{key:"mount",value:function e(){console.warn("Component "+this._name+' does not have "mount" method.')}},{key:"umount",value:function e(){}},{key:"getRef",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;return'[g-ref="'+(n?this._name+":":"")+t+'"]'}},{key:"setState",value:function e(t){var n=this;var i={};Object.keys(t).forEach(function(e){if(Array.isArray(t[e])){if(n._state[e]!=null&&Array.isArray(n._state[e])){if(n._state[e].length===t[e].length){t[e].some(function(r,o){if(n._state[e][o]!==r){i[e]=t[e];n._state[e]=i[e];return true}return false})}else{i[e]=t[e];n._state[e]=i[e]}}else{i[e]=t[e];n._state[e]=i[e]}}else if(o(t[e])==="object"){if(n._state[e]!=null&&o(n._state[e])==="object"){i[e]={};Object.keys(t[e]).forEach(function(r){if(n._state[e][r]!==t[e][r]){i[e][r]=t[e][r]}})}else{i[e]=t[e]}n._state[e]=r({},n._state[e],i[e])}else{if(n._state[e]!==t[e]){i[e]=t[e];n._state[e]=t[e]}}});Object.keys(i).forEach(function(e){if(Array.isArray(t[e])){if(i[e].length===0){delete i[e]}}else if(o(t[e])==="object"){if(Object.keys(i[e]).length===0){delete i[e]}}});this.stateChange(i)}},{key:"stateChange",value:function e(t){}},{key:"ref",get:function e(){return this._ref},set:function e(t){var n=this;var r=(0,u.queryAll)("[g-ref]",this.element);if(Object.keys(t).length===0){r.forEach(function(e){var t=e.getAttribute("g-ref");if(!n._ref[t]){n._ref[t]=r.filter(function(e){return e.getAttribute("g-ref")===t})}})}else{this._ref=Object.keys(t).map(function(e){var o=Array.isArray(t[e]);if(t[e]!==null&&o&&t[e].length>0){return{name:e,value:t[e]}}var i=e;var u=n._name+":"+i;var a=r.filter(function(e){return e.getAttribute("g-ref")===u});if(a.length===0){a=r.filter(function(e){return e.getAttribute("g-ref")===i})}if(!o){a=a.length?a[0]:null}return{name:e,value:a}}).reduce(function(e,t){e[t.name]=t.value;return e},{})}return this._ref}},{key:"options",get:function e(){return this._options},set:function e(t){var n={};var o=this.element.getAttribute("g-options");if(o){n=JSON.parse(o)}this._options=r({},this._options,t,n);return this._options}},{key:"state",get:function e(){return this._state},set:function e(t){console.warn("You should not change state manually. Use setState instead.");this._state=t}}]);return e}();t.default=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=f;var r=n(1);var o=a(r);var i=n(0);var u=a(i);function a(e){return e&&e.__esModule?e:{default:e}}function f(e){var t=(0,o.default)(e);if(t){var n=t._name;t.destroy();e["__gia_component__"]=null;if(u.default.get("log")){console.info('Removed component "'+n+'".')}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=a;var r=n(2);var o=n(5);var i=u(o);function u(e){return e&&e.__esModule?e:{default:e}}function a(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:document.documentElement;(0,r.queryAll)("[g-component]",e).forEach(function(e){(0,i.default)(e)})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=u;var r=n(0);var o=i(r);function i(e){return e&&e.__esModule?e:{default:e}}function u(e,t,n,r){n.prototype._name=t;var i=new n(e,r);if(o.default.get("log")){console.info('Created instance of component "'+t+'".')}return i}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=l;var r=n(2);var o=n(1);var i=f(o);var u=n(7);var a=f(u);function f(e){return e&&e.__esModule?e:{default:e}}function l(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:document.documentElement;if(!e||Object.keys(e).length===0){console.warn("App has no components");return}var n=[];(0,r.queryAll)("[g-component]",t).forEach(function(t){var r=(0,i.default)(t);if(r){console.warn("Error: instance exists: \n",r);return true}var o=t.getAttribute("g-component");if(typeof e[o]==="function"){n.push((0,a.default)(t,o,e[o]))}else{console.warn('Constructor for component "'+o+'" not found.')}});n.forEach(function(e){e._load()})}},function(e,t,n){"use strict";var r=n(8);var o=y(r);var i=n(6);var u=y(i);var a=n(1);var f=y(a);var l=n(4);var s=y(l);var c=n(3);var d=y(c);var v=n(0);var h=y(v);function y(e){return e&&e.__esModule?e:{default:e}}e.exports={loadComponents:o.default,createInstance:o.default,removeComponents:u.default,destroyInstance:u.default,Component:s.default,getComponentFromElement:f.default,eventbus:d.default,config:h.default}}])}); | ||
(function e(t,n){if(typeof exports==="object"&&typeof module==="object")module.exports=n();else if(typeof define==="function"&&define.amd)define([],n);else if(typeof exports==="object")exports["gia"]=n();else t["gia"]=n()})(window,function(){return function(e){var t={};function n(r){if(t[r]){return t[r].exports}var o=t[r]={i:r,l:false,exports:{}};e[r].call(o.exports,o,o.exports,n);o.l=true;return o.exports}n.m=e;n.c=t;n.d=function(e,t,r){if(!n.o(e,t)){Object.defineProperty(e,t,{configurable:false,enumerable:true,get:r})}};n.r=function(e){Object.defineProperty(e,"__esModule",{value:true})};n.n=function(e){var t=e&&e.__esModule?function t(){return e["default"]}:function t(){return e};n.d(t,"a",t);return t};n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};n.p="";return n(n.s=9)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}return function(t,n,r){if(n)e(t.prototype,n);if(r)e(t,r);return t}}();function o(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}var u=function(){function e(){o(this,e);this._options={log:true}}r(e,[{key:"set",value:function e(t,n){this._options[t]=n}},{key:"get",value:function e(t){return this._options[t]}}]);return e}();t.default=new u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=r;function r(e){if(typeof e==="string"){e=document.getElementById(e);if(!e){return null}}return e["__gia_component__"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.query=r;t.queryAll=o;t.toggleClass=u;t.removeClass=i;t.addClass=a;t.triggerEvent=f;function r(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:document;if(typeof e!=="string"){return e}return t.querySelector(e)}function o(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:document;if(typeof e!=="string"){return e}return Array.prototype.slice.call(t.querySelectorAll(e))}function u(e,t){var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;if(n===null){if(e.classList.contains(t)){e.classList.remove(t)}else{e.classList.add(t)}}else{if(n){e.classList.add(t)}else{e.classList.remove(t)}}}function i(e,t){if(Array.isArray(e)){e.forEach(function(e){return e.classList.remove(t)})}else{e.classList.remove(t)}return e}function a(e,t){if(Array.isArray(e)){e.forEach(function(e){return e.classList.add(t)})}else{e.classList.add(t)}return e}function f(e,t){var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;var r=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{bubbles:true,cancelable:true,detail:null};r.detail=n;var o=new CustomEvent(t,r);e.dispatchEvent(o)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}return function(t,n,r){if(n)e(t.prototype,n);if(r)e(t,r);return t}}();var o=n(0);var u=i(o);function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}var f=function(){function e(){a(this,e);this.list={}}r(e,[{key:"emit",value:function e(t){var n=this;var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};r._name=t;if(this.list[t]){if(u.default.get("log")){console.info(this.list[t].length+" handler"+(this.list[t].length>1?"s":"")+" called on event '"+t+"'")}this.list[t].forEach(function(e){e.handler(r);if(e.once){n.off(t,e.handler)}})}else{if(u.default.get("log")){console.info("0 handlers called on event '"+t+"'")}}}},{key:"on",value:function e(t,n){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;if(this.list[t]){this.list[t].push({once:r,handler:n})}else{this.list[t]=[];this.list[t].push({once:r,handler:n})}}},{key:"once",value:function e(t,n){this.on(t,n,true)}},{key:"off",value:function e(t,n){if(t!=null){if(n!=null){if(this.list[t]&&this.list[t].filter(function(e){return e.handler===n}).length){var r=this.list[t].filter(function(e){return e.handler===n})[0];var o=this.list[t].indexOf(r);if(o>-1){this.list[t].splice(o,1)}}else{console.warn("Event "+t+" cannot be unsubscribed - does not exist.")}}else{this.list[t]=[]}}else{this.list={}}}}]);return e}();t.default=new f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n){if(Object.prototype.hasOwnProperty.call(n,r)){e[r]=n[r]}}}return e};var o=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol==="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}return function(t,n,r){if(n)e(t.prototype,n);if(r)e(t,r);return t}}();var i=n(2);function a(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}var f=function(){function e(t,n){a(this,e);this.element=t;this.element["__gia_component__"]=this;this._ref={};this._options=n||{};this._state={}}u(e,[{key:"_load",value:function e(){this.mount()}},{key:"mount",value:function e(){console.warn("Component "+this._name+' does not have "mount" method.')}},{key:"umount",value:function e(){}},{key:"getRef",value:function e(t){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;return'[g-ref="'+(n?this._name+":":"")+t+'"]'}},{key:"setState",value:function e(t){var n=this;var u={};Object.keys(t).forEach(function(e){if(Array.isArray(t[e])){if(n._state[e]!=null&&Array.isArray(n._state[e])){if(n._state[e].length===t[e].length){t[e].some(function(r,o){if(n._state[e][o]!==r){u[e]=t[e];n._state[e]=u[e];return true}return false})}else{u[e]=t[e];n._state[e]=u[e]}}else{u[e]=t[e];n._state[e]=u[e]}}else if(o(t[e])==="object"){if(n._state[e]!=null&&o(n._state[e])==="object"){u[e]={};Object.keys(t[e]).forEach(function(r){if(n._state[e][r]!==t[e][r]){u[e][r]=t[e][r]}})}else{u[e]=t[e]}n._state[e]=r({},n._state[e],u[e])}else{if(n._state[e]!==t[e]){u[e]=t[e];n._state[e]=t[e]}}});Object.keys(u).forEach(function(e){if(Array.isArray(t[e])){if(u[e].length===0){delete u[e]}}else if(o(t[e])==="object"){if(Object.keys(u[e]).length===0){delete u[e]}}});this.stateChange(u)}},{key:"stateChange",value:function e(t){}},{key:"ref",get:function e(){return this._ref},set:function e(t){var n=this;var r=(0,i.queryAll)("[g-ref]",this.element);if(Object.keys(t).length===0){r.forEach(function(e){var t=e.getAttribute("g-ref");if(!n._ref[t]){n._ref[t]=r.filter(function(e){return e.getAttribute("g-ref")===t})}})}else{this._ref=Object.keys(t).map(function(e){var o=Array.isArray(t[e]);if(t[e]!==null&&o&&t[e].length>0){return{name:e,value:t[e]}}var u=e;var i=n._name+":"+u;var a=r.filter(function(e){return e.getAttribute("g-ref")===i});if(a.length===0){a=r.filter(function(e){return e.getAttribute("g-ref")===u})}if(!o){a=a.length?a[0]:null}return{name:e,value:a}}).reduce(function(e,t){e[t.name]=t.value;return e},{})}return this._ref}},{key:"options",get:function e(){return this._options},set:function e(t){var n={};var o=this.element.getAttribute("g-options");if(o){n=JSON.parse(o)}this._options=r({},this._options,t,n);return this._options}},{key:"state",get:function e(){return this._state},set:function e(t){console.warn("You should not change state manually. Use setState instead.");this._state=t}}]);return e}();t.default=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=f;var r=n(1);var o=a(r);var u=n(0);var i=a(u);function a(e){return e&&e.__esModule?e:{default:e}}function f(e){var t=(0,o.default)(e);if(t){var n=t._name;t.unmount();e["__gia_component__"]=null;if(i.default.get("log")){console.info('Removed component "'+n+'".')}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=a;var r=n(2);var o=n(5);var u=i(o);function i(e){return e&&e.__esModule?e:{default:e}}function a(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:document.documentElement;(0,r.queryAll)("[g-component]",e).forEach(function(e){(0,u.default)(e)})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=i;var r=n(0);var o=u(r);function u(e){return e&&e.__esModule?e:{default:e}}function i(e,t,n,r){n.prototype._name=t;var u=new n(e,r);if(o.default.get("log")){console.info('Created instance of component "'+t+'".')}return u}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=l;var r=n(2);var o=n(1);var u=f(o);var i=n(7);var a=f(i);function f(e){return e&&e.__esModule?e:{default:e}}function l(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:document.documentElement;if(!e||Object.keys(e).length===0){console.warn("App has no components");return}var n=[];(0,r.queryAll)("[g-component]",t).forEach(function(t){var r=(0,u.default)(t);if(r){console.warn("Error: instance exists: \n",r);return true}var o=t.getAttribute("g-component");if(typeof e[o]==="function"){n.push((0,a.default)(t,o,e[o]))}else{console.warn('Constructor for component "'+o+'" not found.')}});n.forEach(function(e){e._load()})}},function(e,t,n){"use strict";var r=n(8);var o=y(r);var u=n(6);var i=y(u);var a=n(1);var f=y(a);var l=n(4);var s=y(l);var c=n(3);var d=y(c);var v=n(0);var h=y(v);function y(e){return e&&e.__esModule?e:{default:e}}e.exports={loadComponents:o.default,createInstance:o.default,removeComponents:i.default,destroyInstance:i.default,Component:s.default,getComponentFromElement:f.default,eventbus:d.default,config:h.default}}])}); |
@@ -187,3 +187,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
var name = instance._name; | ||
instance.destroy(); | ||
instance.unmount(); | ||
element['__gia_component__'] = null; | ||
@@ -190,0 +190,0 @@ if (_config2.default.get('log')) { |
@@ -1,1 +0,1 @@ | ||
(function e(t,n){if(typeof exports==="object"&&typeof module==="object")module.exports=n();else if(typeof define==="function"&&define.amd)define([],n);else if(typeof exports==="object")exports["removeComponents"]=n();else t["removeComponents"]=n()})(window,function(){return function(e){var t={};function n(r){if(t[r]){return t[r].exports}var u=t[r]={i:r,l:false,exports:{}};e[r].call(u.exports,u,u.exports,n);u.l=true;return u.exports}n.m=e;n.c=t;n.d=function(e,t,r){if(!n.o(e,t)){Object.defineProperty(e,t,{configurable:false,enumerable:true,get:r})}};n.r=function(e){Object.defineProperty(e,"__esModule",{value:true})};n.n=function(e){var t=e&&e.__esModule?function t(){return e["default"]}:function t(){return e};n.d(t,"a",t);return t};n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};n.p="";return n(n.s=5)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}return function(t,n,r){if(n)e(t.prototype,n);if(r)e(t,r);return t}}();function u(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}var o=function(){function e(){u(this,e);this._options={log:true}}r(e,[{key:"set",value:function e(t,n){this._options[t]=n}},{key:"get",value:function e(t){return this._options[t]}}]);return e}();t.default=new o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=r;function r(e){if(typeof e==="string"){e=document.getElementById(e);if(!e){return null}}return e["__gia_component__"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=f;var r=n(1);var u=l(r);var o=n(0);var i=l(o);function l(e){return e&&e.__esModule?e:{default:e}}function f(e){var t=(0,u.default)(e);if(t){var n=t._name;t.destroy();e["__gia_component__"]=null;if(i.default.get("log")){console.info('Removed component "'+n+'".')}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.query=r;t.queryAll=u;t.toggleClass=o;t.removeClass=i;t.addClass=l;t.triggerEvent=f;function r(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:document;if(typeof e!=="string"){return e}return t.querySelector(e)}function u(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:document;if(typeof e!=="string"){return e}return Array.prototype.slice.call(t.querySelectorAll(e))}function o(e,t){var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;if(n===null){if(e.classList.contains(t)){e.classList.remove(t)}else{e.classList.add(t)}}else{if(n){e.classList.add(t)}else{e.classList.remove(t)}}}function i(e,t){if(Array.isArray(e)){e.forEach(function(e){return e.classList.remove(t)})}else{e.classList.remove(t)}return e}function l(e,t){if(Array.isArray(e)){e.forEach(function(e){return e.classList.add(t)})}else{e.classList.add(t)}return e}function f(e,t){var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;var r=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{bubbles:true,cancelable:true,detail:null};r.detail=n;var u=new CustomEvent(t,r);e.dispatchEvent(u)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=l;var r=n(3);var u=n(2);var o=i(u);function i(e){return e&&e.__esModule?e:{default:e}}function l(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:document.documentElement;(0,r.queryAll)("[g-component]",e).forEach(function(e){(0,o.default)(e)})}},function(e,t,n){"use strict";var r=n(4);var u=o(r);function o(e){return e&&e.__esModule?e:{default:e}}e.exports=u.default}])}); | ||
(function e(t,n){if(typeof exports==="object"&&typeof module==="object")module.exports=n();else if(typeof define==="function"&&define.amd)define([],n);else if(typeof exports==="object")exports["removeComponents"]=n();else t["removeComponents"]=n()})(window,function(){return function(e){var t={};function n(r){if(t[r]){return t[r].exports}var u=t[r]={i:r,l:false,exports:{}};e[r].call(u.exports,u,u.exports,n);u.l=true;return u.exports}n.m=e;n.c=t;n.d=function(e,t,r){if(!n.o(e,t)){Object.defineProperty(e,t,{configurable:false,enumerable:true,get:r})}};n.r=function(e){Object.defineProperty(e,"__esModule",{value:true})};n.n=function(e){var t=e&&e.__esModule?function t(){return e["default"]}:function t(){return e};n.d(t,"a",t);return t};n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};n.p="";return n(n.s=5)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}return function(t,n,r){if(n)e(t.prototype,n);if(r)e(t,r);return t}}();function u(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}var o=function(){function e(){u(this,e);this._options={log:true}}r(e,[{key:"set",value:function e(t,n){this._options[t]=n}},{key:"get",value:function e(t){return this._options[t]}}]);return e}();t.default=new o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=r;function r(e){if(typeof e==="string"){e=document.getElementById(e);if(!e){return null}}return e["__gia_component__"]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=f;var r=n(1);var u=l(r);var o=n(0);var i=l(o);function l(e){return e&&e.__esModule?e:{default:e}}function f(e){var t=(0,u.default)(e);if(t){var n=t._name;t.unmount();e["__gia_component__"]=null;if(i.default.get("log")){console.info('Removed component "'+n+'".')}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.query=r;t.queryAll=u;t.toggleClass=o;t.removeClass=i;t.addClass=l;t.triggerEvent=f;function r(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:document;if(typeof e!=="string"){return e}return t.querySelector(e)}function u(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:document;if(typeof e!=="string"){return e}return Array.prototype.slice.call(t.querySelectorAll(e))}function o(e,t){var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;if(n===null){if(e.classList.contains(t)){e.classList.remove(t)}else{e.classList.add(t)}}else{if(n){e.classList.add(t)}else{e.classList.remove(t)}}}function i(e,t){if(Array.isArray(e)){e.forEach(function(e){return e.classList.remove(t)})}else{e.classList.remove(t)}return e}function l(e,t){if(Array.isArray(e)){e.forEach(function(e){return e.classList.add(t)})}else{e.classList.add(t)}return e}function f(e,t){var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;var r=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{bubbles:true,cancelable:true,detail:null};r.detail=n;var u=new CustomEvent(t,r);e.dispatchEvent(u)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:true});t.default=l;var r=n(3);var u=n(2);var o=i(u);function i(e){return e&&e.__esModule?e:{default:e}}function l(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:document.documentElement;(0,r.queryAll)("[g-component]",e).forEach(function(e){(0,o.default)(e)})}},function(e,t,n){"use strict";var r=n(4);var u=o(r);function o(e){return e&&e.__esModule?e:{default:e}}e.exports=u.default}])}); |
{ | ||
"name": "gia", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Minimalistic JS framework for server rendered websites.", | ||
@@ -21,3 +21,3 @@ "main": "dist/gia.js", | ||
"build": "webpack-cli", | ||
"prepublish": "npm run compile" | ||
"prepublish": "npm run compile && npm run build" | ||
}, | ||
@@ -24,0 +24,0 @@ "author": "Georgy Marchuk", |
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
224742