Comparing version 1.0.0 to 1.0.1
@@ -257,3 +257,39 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
}); | ||
exports.default = createInstance; | ||
var _config = __webpack_require__(0); | ||
var _config2 = _interopRequireDefault(_config); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** | ||
* Creates and returns instance of component | ||
* @param element: DOM element | ||
* @param componentName: Component name | ||
* @param component: Component constructor | ||
* @param options: options object passed into a component | ||
*/ | ||
function createInstance(element, componentName, component, options) { | ||
component.prototype._name = componentName; | ||
var instance = new component(element, options); | ||
if (_config2.default.get('log')) { | ||
console.info('Created instance of component "' + componentName + '".'); | ||
} | ||
return instance; | ||
} | ||
/***/ }), | ||
/* 4 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
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; }; }(); | ||
@@ -354,3 +390,3 @@ | ||
/***/ }), | ||
/* 4 */ | ||
/* 5 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -586,3 +622,3 @@ | ||
/***/ }), | ||
/* 5 */ | ||
/* 6 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -626,3 +662,3 @@ | ||
/***/ }), | ||
/* 6 */ | ||
/* 7 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
@@ -640,3 +676,3 @@ | ||
var _destroyInstance = __webpack_require__(5); | ||
var _destroyInstance = __webpack_require__(6); | ||
@@ -661,38 +697,2 @@ var _destroyInstance2 = _interopRequireDefault(_destroyInstance); | ||
/***/ }), | ||
/* 7 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = createInstance; | ||
var _config = __webpack_require__(0); | ||
var _config2 = _interopRequireDefault(_config); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** | ||
* Creates and returns instance of component | ||
* @param element: DOM element | ||
* @param componentName: Component name | ||
* @param component: Component constructor | ||
* @param options: options object passed into a component | ||
*/ | ||
function createInstance(element, componentName, component, options) { | ||
component.prototype._name = componentName; | ||
var instance = new component(element, options); | ||
if (_config2.default.get('log')) { | ||
console.info('Created instance of component "' + componentName + '".'); | ||
} | ||
return instance; | ||
} | ||
/***/ }), | ||
/* 8 */ | ||
@@ -715,3 +715,3 @@ /***/ (function(module, exports, __webpack_require__) { | ||
var _createInstance = __webpack_require__(7); | ||
var _createInstance = __webpack_require__(3); | ||
@@ -774,4 +774,8 @@ var _createInstance2 = _interopRequireDefault(_createInstance); | ||
var _removeComponents = __webpack_require__(6); | ||
var _createInstance = __webpack_require__(3); | ||
var _createInstance2 = _interopRequireDefault(_createInstance); | ||
var _removeComponents = __webpack_require__(7); | ||
var _removeComponents2 = _interopRequireDefault(_removeComponents); | ||
@@ -783,7 +787,7 @@ | ||
var _BaseComponent = __webpack_require__(4); | ||
var _BaseComponent = __webpack_require__(5); | ||
var _BaseComponent2 = _interopRequireDefault(_BaseComponent); | ||
var _eventbus = __webpack_require__(3); | ||
var _eventbus = __webpack_require__(4); | ||
@@ -800,3 +804,3 @@ var _eventbus2 = _interopRequireDefault(_eventbus); | ||
loadComponents: _loadComponents2.default, | ||
createInstance: _loadComponents2.default, | ||
createInstance: _createInstance2.default, | ||
removeComponents: _removeComponents2.default, | ||
@@ -803,0 +807,0 @@ destroyInstance: _removeComponents2.default, |
@@ -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:"unmount",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(t.indexOf(":")!==-1){var o=t.split(":");if(o[0]==n._name){if(!n._ref[o[1]]){n._ref[o[1]]=r.filter(function(e){return e.getAttribute("g-ref")===t})}}else{return}}else{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.unmount();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 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});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});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:"unmount",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(t.indexOf(":")!==-1){var o=t.split(":");if(o[0]==n._name){if(!n._ref[o[1]]){n._ref[o[1]]=r.filter(function(e){return e.getAttribute("g-ref")===t})}}else{return}}else{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.unmount();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(6);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=l;var r=n(2);var o=n(1);var i=f(o);var u=n(3);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=_(r);var i=n(3);var u=_(i);var a=n(7);var f=_(a);var l=n(1);var s=_(l);var c=n(5);var d=_(c);var v=n(4);var h=_(v);var y=n(0);var p=_(y);function _(e){return e&&e.__esModule?e:{default:e}}e.exports={loadComponents:o.default,createInstance:u.default,removeComponents:f.default,destroyInstance:f.default,Component:d.default,getComponentFromElement:s.default,eventbus:h.default,config:p.default}}])}); |
{ | ||
"name": "gia", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Minimalistic JavaScript framework for server rendered websites.", | ||
@@ -5,0 +5,0 @@ "main": "dist/gia.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
228063
4091