From 589ac5cf0f8fc843b117c108d7498b6a8e57b327 Mon Sep 17 00:00:00 2001 From: bellord13 Date: Sat, 16 Nov 2024 21:12:09 +0300 Subject: [PATCH] fix --- assets/ActionCollection/ActionCollection.js | 2 +- .../ActionCollection/ActionCollection.min.js | 1 + assets/Collection/Collection.js | 70 +++++++++++---- assets/Collection/Collection.min.js | 2 +- assets/bsCore/bsCore.min.js | 2 +- assets/bsToast/bsToast.js | 2 +- assets/bsToast/bsToast.min.js | 1 + assets/core/core.js | 89 +++++++++++++------ assets/core/core.min.js | 2 +- assets/menu/menu.js | 1 - assets/menu/menu.min.js | 1 + assets/support/support.js | 14 ++- assets/support/support.min.js | 2 +- 13 files changed, 141 insertions(+), 48 deletions(-) create mode 100644 assets/ActionCollection/ActionCollection.min.js create mode 100644 assets/bsToast/bsToast.min.js create mode 100644 assets/menu/menu.min.js diff --git a/assets/ActionCollection/ActionCollection.js b/assets/ActionCollection/ActionCollection.js index b0bce25..f7bef58 100644 --- a/assets/ActionCollection/ActionCollection.js +++ b/assets/ActionCollection/ActionCollection.js @@ -7,7 +7,7 @@ __PluginManager__.register('ActionCollection', function(require, exports, module /** * @class ActionCollection * @extends {Collection} - * @memberOf kit + * @memberOf {kit} */ var ActionCollection = function (list = []) { Collection.prototype.constructor.apply(this, arguments); diff --git a/assets/ActionCollection/ActionCollection.min.js b/assets/ActionCollection/ActionCollection.min.js new file mode 100644 index 0000000..3b0a295 --- /dev/null +++ b/assets/ActionCollection/ActionCollection.min.js @@ -0,0 +1 @@ +__PluginManager__.register("ActionCollection",function(t,o,n,p){function r(t=0){i.prototype.constructor.apply(this,arguments)}var i=t("Collection"),t=t("support"),e=r.prototype;return e.run=function(o=-1){this.map(function(t){t.run(o)})},e.stop=function(){this.map(function(t){t.stop()})},t.extend(r.prototype,i.prototype),n.exports=r}); \ No newline at end of file diff --git a/assets/Collection/Collection.js b/assets/Collection/Collection.js index dd3f5c8..52625af 100644 --- a/assets/Collection/Collection.js +++ b/assets/Collection/Collection.js @@ -23,9 +23,7 @@ __PluginManager__.register('Collection', function(require, exports, module, glob } /** - * @class Collection - * @property length - * @memberOf {kit} + * @memberOf kit */ var Collection = function (data = []) { var self = this; @@ -79,6 +77,10 @@ __PluginManager__.register('Collection', function(require, exports, module, glob } return lastIndex; }; + + /** + * @returns {{}|*[]} + */ Collection.prototype.all = function () { if(this.__type === 'array' || this.__type === 'arrayObject') { return this.toArray(); @@ -114,7 +116,7 @@ __PluginManager__.register('Collection', function(require, exports, module, glob /** * @param key * @param value - * @return {Collection} + * @return this */ Collection.prototype.add = Collection.prototype.set = Collection.prototype.put = function (key, value) { var index = -1; @@ -128,7 +130,7 @@ __PluginManager__.register('Collection', function(require, exports, module, glob }; /** * @param value - * @return {Collection} + * @return this */ Collection.prototype.push = function (value) { this.set(this.__getLastIndex() + 1, value); @@ -193,7 +195,7 @@ __PluginManager__.register('Collection', function(require, exports, module, glob }; /** * @param callback - * @return {Collection} + * @return this */ Collection.prototype.filter = function (callback = filter) { var res = getSimilarInstance(this.__type); @@ -208,7 +210,7 @@ __PluginManager__.register('Collection', function(require, exports, module, glob /** * Метод возвращает все элементы коллекции, кроме тех у кого ключи соответствуют заданным * @param keys - * @return {Collection} + * @return this */ Collection.prototype.except = function (keys) { var __keys = [], iKey; @@ -410,11 +412,8 @@ __PluginManager__.register('Collection', function(require, exports, module, glob } var n = fromIndex | 0; var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0); - function sameValueZero(x, y) { - return x === y || (typeof x === 'number' && typeof y === 'number' && isNaN(x) && isNaN(y)); - } while (k < len) { - if (sameValueZero(this.__values[k], searchElement)) { + if (support.isEqualArrayValues(this.__values[k], searchElement, true)) { return true; } k++; @@ -422,17 +421,58 @@ __PluginManager__.register('Collection', function(require, exports, module, glob return false; }; + Collection.prototype.contains = function(value, strict = false) { + var len = this.__keys.length, k = 0; + if (len === 0) { + return false; + } + if (support.isFunction(value)) { + return this.filter(value).count() > 0; + } + while (k < len) { + if (support.isEqualArrayValues(this.__values[k], value, strict)) { + return true; + } + k++; + } + return false; + }; + + Collection.prototype.hasAnyValue = function(valueList, strict = false) { + var valueCollection = new Collection(valueList); + var res = false; + this.each(function(v, k, arr){ + if (valueCollection.contains(v, strict)) { + res = true; + return false; + } + return true; + }); + return res; + }; + + Collection.prototype.hasAnyKey = function(keyList) { + var keyCollection = new Collection(valueList); + var res = false; + this.each(function(v, k, arr){ + if (keyCollection.contains(k, false)) { + res = true; + return false; + } + return true; + }); + return res; + }; + + Collection.prototype.search = function(searchElement) { var len = this.__keys.length; if (len === 0) { return false; } var k = 0; - function sameValueZero(x, y) { - return x === y || (typeof x === 'number' && typeof y === 'number' && isNaN(x) && isNaN(y)); - } while (k < len) { - if (sameValueZero(this.__values[k], searchElement)) { + if (support.isEqualArrayValues(this.__values[k], searchElement, true)) { return this.__keys[k]; } k++; diff --git a/assets/Collection/Collection.min.js b/assets/Collection/Collection.min.js index 2b791bf..0db179c 100644 --- a/assets/Collection/Collection.min.js +++ b/assets/Collection/Collection.min.js @@ -1 +1 @@ -__PluginManager__.register("Collection",function(t,e,i,r){var n=t("support"),o=n.valueEx;function s(t){return n.arr.isKey(t)?Number(t):""+t}function h(t){return new u("object"===t?{}:[])}function u(t=[]){var e,i=this;if(this.data=t,n.definePropertyGet(this,"length",function(){return i.__keys.length}),t instanceof u)this.__type=t.__type,this.__keys=t.__keys,this.__values=t.__values;else for(e in Array.isArray(t)?this.__type="array":"object"==typeof t?(this.__type="object",t.hasOwnProperty("length")&&!Object.keys(t).includes("length")&&(this.__type="arrayObject")):(this.__type="array",this.data=[t],console.warn("collection: not support data"+typeof t)),this.__keys=[],this.__values=[],this.data)this.data.hasOwnProperty(e)&&(this.__keys.push(s(e)),this.__values.push(this.data[e]))}return u.prototype.__getLastIndex=function(){var t,e,i=-1;for(e in this.__keys)t=this.__keys[e],n.isNumber(t)&&ie.has(t)&&e.get(t).get(n)||null,remove(t,n){if(!e.has(t))return;const i=e.get(t);i.delete(n),0===i.size&&e.delete(t)}}}(),a.SelectorEngine={find:(e,t=document.documentElement)=>[].concat(...Element.prototype.querySelectorAll.call(t,e)),findOne:(e,t=document.documentElement)=>Element.prototype.querySelector.call(t,e),children:(e,t)=>[].concat(...e.children).filter(e=>e.matches(t)),parents(e,t){const n=[];let i=e.parentNode;for(;i&&i.nodeType===Node.ELEMENT_NODE&&3!==i.nodeType;)i.matches(t)&&n.push(i),i=i.parentNode;return n},prev(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return[n];n=n.previousElementSibling}return[]},next(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return[n];n=n.nextElementSibling}return[]}},a.Manipulator=function(){function e(e){return"true"===e||"false"!==e&&(e===Number(e).toString()?Number(e):""===e||"null"===e?null:e)}function t(e){return e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}return{setDataAttribute(e,n,i){e.setAttribute(`data-bs-${t(n)}`,i)},removeDataAttribute(e,n){e.removeAttribute(`data-bs-${t(n)}`)},getDataAttributes(t){if(!t)return{};const n={};return Object.keys(t.dataset).filter(e=>e.startsWith("bs")).forEach(i=>{let o=i.replace(/^bs/,"");o=o.charAt(0).toLowerCase()+o.slice(1,o.length),n[o]=e(t.dataset[i])}),n},getDataAttribute:(n,i)=>e(n.getAttribute(`data-bs-${t(i)}`)),offset(e){const t=e.getBoundingClientRect();return{top:t.top+document.body.scrollTop,left:t.left+document.body.scrollLeft}},position:e=>({top:e.offsetTop,left:e.offsetLeft})}}(),c.index=function(e){const t=e=>{let t=e.getAttribute("data-bs-target");if(!t||"#"===t){let n=e.getAttribute("href");if(!n||!n.includes("#")&&!n.startsWith("."))return null;n.includes("#")&&!n.startsWith("#")&&(n=`#${n.split("#")[1]}`),t=n&&"#"!==n?n.trim():null}return t},n=e=>{if(!e)return 0;let{transitionDuration:t,transitionDelay:n}=window.getComputedStyle(e);const i=Number.parseFloat(t),o=Number.parseFloat(n);return i||o?(t=t.split(",")[0],n=n.split(",")[0],1e3*(Number.parseFloat(t)+Number.parseFloat(n))):0},o=e=>{e.dispatchEvent(new Event("transitionend"))},r=e=>!(!e||"object"!=typeof e)&&(void 0!==e.jquery&&(e=e[0]),void 0!==e.nodeType),s=e=>{if(!document.documentElement.attachShadow)return null;if("function"==typeof e.getRootNode){const t=e.getRootNode();return t instanceof ShadowRoot?t:null}return e instanceof ShadowRoot?e:e.parentNode?s(e.parentNode):null},l=()=>{const{jquery:e}=i;return e&&!document.body.hasAttribute("data-bs-no-jquery")?e:null},a=[],c=e=>{"loading"===document.readyState?(a.length||document.addEventListener("DOMContentLoaded",()=>{a.forEach(e=>e())}),a.push(e)):e()},u=e=>{"function"==typeof e&&e()};return{getElement:t=>r(t)?t.jquery?t[0]:t:"string"==typeof t&&t.length>0?e.findOne(t):null,getUID:e=>{do{e+=Math.floor(1e6*Math.random())}while(document.getElementById(e));return e},getSelector:t,getSelectorFromElement:e=>{const n=t(e);return n&&document.querySelector(n)?n:null},getElementFromSelector:e=>{const n=t(e);return n?document.querySelector(n):null},getTransitionDurationFromElement:n,triggerTransitionEnd:o,isElement:r,typeCheckConfig:(e,t,n)=>{Object.keys(n).forEach(i=>{const o=n[i],s=t[i],l=s&&r(s)?"element":(e=>null==e?`${e}`:{}.toString.call(e).match(/\s([a-z]+)/i)[1].toLowerCase())(s);if(!new RegExp(o).test(l))throw new TypeError(`${e.toUpperCase()}: Option "${i}" provided type "${l}" but expected type "${o}".`)})},isVisible:e=>!(!r(e)||0===e.getClientRects().length)&&"visible"===getComputedStyle(e).getPropertyValue("visibility"),isDisabled:e=>!e||e.nodeType!==Node.ELEMENT_NODE||!!e.classList.contains("disabled")||(void 0!==e.disabled?e.disabled:e.hasAttribute("disabled")&&"false"!==e.getAttribute("disabled")),findShadowRoot:s,noop:()=>{},getNextActiveElement:(e,t,n,i)=>{let o=e.indexOf(t);if(-1===o)return e[!n&&i?e.length-1:0];const r=e.length;return o+=n?1:-1,i&&(o=(o+r)%r),e[Math.max(0,Math.min(o,r-1))]},reflow:e=>e.offsetHeight,getjQuery:l,onDOMContentLoaded:c,isRTL:()=>"rtl"===document.documentElement.dir,defineJQueryPlugin:e=>{c(()=>{const t=l();if(t){const n=e.NAME,i=t.fn[n];t.fn[n]=e.jQueryInterface,t.fn[n].Constructor=e,t.fn[n].noConflict=(()=>(t.fn[n]=i,e.jQueryInterface))}})},execute:u,executeAfterTransition:(e,t,i=!0)=>{if(!i)return void u(e);const r=n(t)+5;let s=!1;const l=({target:n})=>{n===t&&(s=!0,t.removeEventListener("transitionend",l),u(e))};t.addEventListener("transitionend",l),setTimeout(()=>{s||o(t)},r)}}}(a.SelectorEngine),a.EventHandler=function(e){const t=/[^.]*(?=\..*)\.|.*/,n=/\..*/,i=/::\d+$/,o={};let r=1;const s={mouseenter:"mouseover",mouseleave:"mouseout"},l=/^(mouseenter|mouseleave)/i,a=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function c(e,t){return t&&`${t}::${r++}`||e.uidEvent||r++}function u(e){const t=c(e);return e.uidEvent=t,o[t]=o[t]||{},o[t]}function d(e,t,n=null){const i=Object.keys(e);for(let o=0,r=i.length;o(function(t){if(!t.relatedTarget||t.relatedTarget!==t.delegateTarget&&!t.delegateTarget.contains(t.relatedTarget))return e.call(this,t)});o?o=e(o):i=e(i)}const[s,a,m]=f(n,i,o),h=u(e),g=h[m]||(h[m]={}),b=d(g,a,s?i:null);if(b)return void(b.oneOff=b.oneOff&&r);const E=c(a,n.replace(t,"")),y=s?function(e,t,n){return function i(o){const r=e.querySelectorAll(t);for(let{target:s}=o;s&&s!==this;s=s.parentNode)for(let l=r.length;l--;)if(r[l]===s)return o.delegateTarget=s,i.oneOff&&p.off(e,o.type,t,n),n.apply(s,[o]);return null}}(e,i,o):function(e,t){return function n(i){return i.delegateTarget=e,n.oneOff&&p.off(e,i.type,t),t.apply(e,[i])}}(e,i);y.delegationSelector=s?i:null,y.originalHandler=a,y.oneOff=r,y.uidEvent=E,g[E]=y,e.addEventListener(m,y,s)}function h(e,t,n,i,o){const r=d(t[n],i,o);r&&(e.removeEventListener(n,r,Boolean(o)),delete t[n][r.uidEvent])}function g(e){return e=e.replace(n,""),s[e]||e}const p={on(e,t,n,i){m(e,t,n,i,!1)},one(e,t,n,i){m(e,t,n,i,!0)},off(e,t,n,o){if("string"!=typeof t||!e)return;const[r,s,l]=f(t,n,o),a=l!==t,c=u(e),d=t.startsWith(".");if(void 0!==s){if(!c||!c[l])return;return void h(e,c,l,s,r?n:null)}d&&Object.keys(c).forEach(n=>{!function(e,t,n,i){const o=t[n]||{};Object.keys(o).forEach(r=>{if(r.includes(i)){const i=o[r];h(e,t,n,i.originalHandler,i.delegationSelector)}})}(e,c,n,t.slice(1))});const m=c[l]||{};Object.keys(m).forEach(n=>{const o=n.replace(i,"");if(!a||t.includes(o)){const t=m[n];h(e,c,l,t.originalHandler,t.delegationSelector)}})},trigger(t,n,i){if("string"!=typeof n||!t)return null;const o=e(),r=g(n),s=n!==r,l=a.has(r);let c,u=!0,d=!0,f=!1,m=null;return s&&o&&(c=o.Event(n,i),o(t).trigger(c),u=!c.isPropagationStopped(),d=!c.isImmediatePropagationStopped(),f=c.isDefaultPrevented()),l?(m=document.createEvent("HTMLEvents")).initEvent(r,u,!0):m=new CustomEvent(n,{bubbles:u,cancelable:!0}),void 0!==i&&Object.keys(i).forEach(e=>{Object.defineProperty(m,e,{get:()=>i[e]})}),f&&m.preventDefault(),d&&t.dispatchEvent(m),m.defaultPrevented&&void 0!==c&&c.preventDefault(),m}};return p}(c.index.getjQuery),c.Backdrop=function(e,t,n,i,o,r){const s={isVisible:!0,isAnimated:!1,rootElement:"body",clickCallback:null},l={isVisible:"boolean",isAnimated:"boolean",rootElement:"(element|string)",clickCallback:"(function|null)"},a="backdrop",c="modal-backdrop",u="fade",d="show",f=`mousedown.bs.${a}`;return class{constructor(e){this._config=this._getConfig(e),this._isAppended=!1,this._element=null}show(e){this._config.isVisible?(this._append(),this._config.isAnimated&&o(this._getElement()),this._getElement().classList.add(d),this._emulateAnimation(()=>{t(e)})):t(e)}hide(e){this._config.isVisible?(this._getElement().classList.remove(d),this._emulateAnimation(()=>{this.dispose(),t(e)})):t(e)}_getElement(){if(!this._element){const e=document.createElement("div");e.className=c,this._config.isAnimated&&e.classList.add(u),this._element=e}return this._element}_getConfig(e){return(e={...s,..."object"==typeof e?e:{}}).rootElement=i(e.rootElement),r(a,e,l),e}_append(){this._isAppended||(this._config.rootElement.appendChild(this._getElement()),e.on(this._getElement(),f,()=>{t(this._config.clickCallback)}),this._isAppended=!0)}dispose(){this._isAppended&&(e.off(this._element,f),this._element.remove(),this._isAppended=!1)}_emulateAnimation(e){n(e,this._getElement(),this._config.isAnimated)}}}(a.EventHandler,c.index.execute,c.index.executeAfterTransition,c.index.getElement,c.index.reflow,c.index.typeCheckConfig),c.sanitizer=function(){const e=new Set(["background","cite","href","itemtype","longdesc","poster","src","xlink:href"]),t=/^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/i,n=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i,i=(i,o)=>{const r=i.nodeName.toLowerCase();if(o.includes(r))return!e.has(r)||Boolean(t.test(i.nodeValue)||n.test(i.nodeValue));const s=o.filter(e=>e instanceof RegExp);for(let e=0,t=s.length;e{i(e,a)||n.removeAttribute(e.nodeName)})}return o.body.innerHTML}}}(),c.ScrollBarHelper=function(e,t,n){const i=".fixed-top, .fixed-bottom, .is-fixed, .sticky-top",o=".sticky-top";return class{constructor(){this._element=document.body}getWidth(){const e=document.documentElement.clientWidth;return Math.abs(window.innerWidth-e)}hide(){const e=this.getWidth();this._disableOverFlow(),this._setElementAttributes(this._element,"paddingRight",t=>t+e),this._element.style.setProperty("--scroll-bar-size",`${e}px`),this._setElementAttributes(i,"paddingRight",t=>t+e),this._setElementAttributes(o,"marginRight",t=>t-e)}_disableOverFlow(){this._saveInitialAttribute(this._element,"overflow"),this._element.style.overflow="hidden"}_setElementAttributes(e,t,n){const i=this.getWidth();this._applyManipulationCallback(e,e=>{if(e!==this._element&&window.innerWidth>e.clientWidth+i)return;this._saveInitialAttribute(e,t);const o=window.getComputedStyle(e)[t];e.style[t]=`${n(Number.parseFloat(o))}px`})}reset(){this._resetElementAttributes(this._element,"overflow"),this._resetElementAttributes(this._element,"paddingRight"),this._resetElementAttributes(i,"paddingRight"),this._resetElementAttributes(o,"marginRight"),this._element.style.setProperty("--scroll-bar-size","0")}_saveInitialAttribute(e,n){const i=e.style[n];i&&t.setDataAttribute(e,n,i)}_resetElementAttributes(e,n){this._applyManipulationCallback(e,e=>{const i=t.getDataAttribute(e,n);void 0===i?e.style.removeProperty(n):(t.removeDataAttribute(e,n),e.style[n]=i)})}_applyManipulationCallback(t,i){n(t)?i(t):e.find(t,this._element).forEach(i)}isOverflowing(){return this.getWidth()>0}}}(a.SelectorEngine,a.Manipulator,c.index.isElement),c.componentFunctions=(o=a.EventHandler,r=c.index.getElementFromSelector,s=c.index.isDisabled,{enableDismissTrigger:(e,t="hide")=>{const n=`click.dismiss${e.EVENT_KEY}`,i=e.NAME;o.on(document,n,`[data-bs-dismiss="${i}"]`,function(n){if(["A","AREA"].includes(this.tagName)&&n.preventDefault(),s(this))return;const o=r(this)||this.closest(`.${i}`);e.getOrCreateInstance(o)[t]()})}}),l.BaseComponent=function(e,t,n,i){const o="5.0.2";return class{constructor(t){(t=n(t))&&(this._element=t,e.set(this._element,this.constructor.DATA_KEY,this))}dispose(){e.remove(this._element,this.constructor.DATA_KEY),i.off(this._element,this.constructor.EVENT_KEY),Object.getOwnPropertyNames(this).forEach(e=>{this[e]=null})}_queueCallback(e,n,i=!0){t(e,n,i)}static getInstance(t){return e.get(t,this.DATA_KEY)}static getOrCreateInstance(e,t={}){return this.getInstance(e)||new this(e,"object"==typeof t?t:null)}static get VERSION(){return o}static get NAME(){throw new Error('You have to implement the static method "NAME", for each component!')}static get DATA_KEY(){return`bs.${this.NAME}`}static get EVENT_KEY(){return`.${this.DATA_KEY}`}}}(a.Data,c.index.executeAfterTransition,c.index.getElement,a.EventHandler),l.util=c,l.dom=a,n.exports=l,n.exports}); \ No newline at end of file +__PluginManager__.register("bsCore",function(e,t,n,c){var i,o,l,r,s,a,u,d={},m={},h={};function f(e){return"true"===e||"false"!==e&&(e===Number(e).toString()?Number(e):""===e||"null"===e?null:e)}function g(e){return e.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}return m.Data=function(){let r=new Map;return{set(e,t,n){r.has(e)||r.set(e,new Map);e=r.get(e);e.has(t)||0===e.size?e.set(t,n):console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(e.keys())[0]}.`)},get(e,t){return r.has(e)&&r.get(e).get(t)||null},remove(e,t){var n;r.has(e)&&((n=r.get(e)).delete(t),0===n.size)&&r.delete(e)}}}(),m.SelectorEngine={find(e,t=document.documentElement){return[].concat(...Element.prototype.querySelectorAll.call(t,e))},findOne(e,t=document.documentElement){return Element.prototype.querySelector.call(t,e)},children(e,t){return[].concat(...e.children).filter(e=>e.matches(t))},parents(e,t){var n=[];let r=e.parentNode;for(;r&&r.nodeType===Node.ELEMENT_NODE&&3!==r.nodeType;)r.matches(t)&&n.push(r),r=r.parentNode;return n},prev(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return[n];n=n.previousElementSibling}return[]},next(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return[n];n=n.nextElementSibling}return[]}},m.Manipulator={setDataAttribute(e,t,n){e.setAttribute("data-bs-"+g(t),n)},removeDataAttribute(e,t){e.removeAttribute("data-bs-"+g(t))},getDataAttributes(n){if(!n)return{};let r={};return Object.keys(n.dataset).filter(e=>e.startsWith("bs")).forEach(e=>{let t=e.replace(/^bs/,"");t=t.charAt(0).toLowerCase()+t.slice(1,t.length),r[t]=f(n.dataset[e])}),r},getDataAttribute(e,t){return f(e.getAttribute("data-bs-"+g(t)))},offset(e){e=e.getBoundingClientRect();return{top:e.top+document.body.scrollTop,left:e.left+document.body.scrollLeft}},position(e){return{top:e.offsetTop,left:e.offsetLeft}}},h.index=function(t){let o="transitionend";let n=t=>{let n=t.getAttribute("data-bs-target");if(!n||"#"===n){let e=t.getAttribute("href");if(!e||!e.includes("#")&&!e.startsWith("."))return null;e.includes("#")&&!e.startsWith("#")&&(e="#"+e.split("#")[1]),n=e&&"#"!==e?e.trim():null}return n};let l=e=>{if(!e)return 0;let{transitionDuration:t,transitionDelay:n}=window.getComputedStyle(e);var e=Number.parseFloat(t),r=Number.parseFloat(n);return e||r?(t=t.split(",")[0],n=n.split(",")[0],1e3*(Number.parseFloat(t)+Number.parseFloat(n))):0},s=e=>{e.dispatchEvent(new Event(o))},a=e=>!(!e||"object"!=typeof e)&&void 0!==(e=void 0!==e.jquery?e[0]:e).nodeType;let r=e=>{var t;return document.documentElement.attachShadow?"function"==typeof e.getRootNode?(t=e.getRootNode())instanceof ShadowRoot?t:null:e instanceof ShadowRoot?e:e.parentNode?r(e.parentNode):null:null};let e=()=>{var e=c["jquery"];return e&&!document.body.hasAttribute("data-bs-no-jquery")?e:null},i=[],u=e=>{"loading"===document.readyState?(i.length||document.addEventListener("DOMContentLoaded",()=>{i.forEach(e=>e())}),i.push(e)):e()};let d=e=>{"function"==typeof e&&e()};return{getElement:e=>a(e)?e.jquery?e[0]:e:"string"==typeof e&&0{for(;e+=Math.floor(1e6*Math.random()),document.getElementById(e););return e},getSelector:n,getSelectorFromElement:e=>{e=n(e);return e&&document.querySelector(e)?e:null},getElementFromSelector:e=>{e=n(e);return e?document.querySelector(e):null},getTransitionDurationFromElement:l,triggerTransitionEnd:s,isElement:a,typeCheckConfig:(r,i,o)=>{Object.keys(o).forEach(e=>{var t=o[e],n=i[e],n=n&&a(n)?"element":null==(n=n)?""+n:{}.toString.call(n).match(/\s([a-z]+)/i)[1].toLowerCase();if(!new RegExp(t).test(n))throw new TypeError(r.toUpperCase()+`: Option "${e}" provided type "${n}" but expected type "${t}".`)})},isVisible:e=>!(!a(e)||0===e.getClientRects().length)&&"visible"===getComputedStyle(e).getPropertyValue("visibility"),isDisabled:e=>!e||e.nodeType!==Node.ELEMENT_NODE||!!e.classList.contains("disabled")||(void 0!==e.disabled?e.disabled:e.hasAttribute("disabled")&&"false"!==e.getAttribute("disabled")),findShadowRoot:r,noop:()=>{},getNextActiveElement:(e,t,n,r)=>{let i=e.indexOf(t);return-1===i?e[!n&&r?e.length-1:0]:(t=e.length,i+=n?1:-1,r&&(i=(i+t)%t),e[Math.max(0,Math.min(i,t-1))])},reflow:e=>e.offsetHeight,getjQuery:e,onDOMContentLoaded:u,isRTL:()=>"rtl"===document.documentElement.dir,defineJQueryPlugin:r=>{u(()=>{let n=e();if(n){let e=r.NAME,t=n.fn[e];n.fn[e]=r.jQueryInterface,n.fn[e].Constructor=r,n.fn[e].noConflict=()=>(n.fn[e]=t,r.jQueryInterface)}})},execute:d,executeAfterTransition:(r,i,e=!0)=>{if(e){e=l(i)+5;let t=!1,n=({target:e})=>{e===i&&(t=!0,i.removeEventListener(o,n),d(r))};i.addEventListener(o,n),setTimeout(()=>{t||s(i)},e)}else d(r)}}}(m.SelectorEngine),m.EventHandler=function(m){let g=/[^.]*(?=\..*)\.|.*/,t=/\..*/,d=/::\d+$/,n={},r=1,i={mouseenter:"mouseover",mouseleave:"mouseout"},p=/^(mouseenter|mouseleave)/i,h=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function b(e,t){return t&&t+"::"+r++||e.uidEvent||r++}function E(e){var t=b(e);return e.uidEvent=t,n[t]=n[t]||{},n[t]}function v(n,r,i=null){var o=Object.keys(n);for(let e=0,t=o.length;efunction(e){if(!e.relatedTarget||e.relatedTarget!==e.delegateTarget&&!e.delegateTarget.contains(e.relatedTarget))return t.call(this,e)},r?r=o(r):n=o(n)),y(t,n,r)),(u=v(a=(a=E(e))[s]||(a[s]={}),l,o?n:null))?u.oneOff=u.oneOff&&i:(u=b(l,t.replace(g,"")),(t=o?(m=e,h=n,f=r,function n(r){var i=m.querySelectorAll(h);for(let t=r["target"];t&&t!==this;t=t.parentNode)for(let e=i.length;e--;)if(i[e]===t)return r.delegateTarget=t,n.oneOff&&_.off(m,r.type,h,f),f.apply(t,[r]);return null}):(d=e,c=n,function e(t){return t.delegateTarget=d,e.oneOff&&_.off(d,t.type,c),c.apply(d,[t])})).delegationSelector=o?n:null,t.originalHandler=l,t.oneOff=i,a[t.uidEvent=u]=t,e.addEventListener(s,t,o)))}function c(e,t,n,r,i){r=v(t[n],r,i);r&&(e.removeEventListener(n,r,Boolean(i)),delete t[n][r.uidEvent])}function f(e){return e=e.replace(t,""),i[e]||e}let _={on(e,t,n,r){o(e,t,n,r,!1)},one(e,t,n,r){o(e,t,n,r,!0)},off(s,a,o,u){if("string"==typeof a&&s){let[e,t,n]=y(a,o,u),r=n!==a,l=E(s);u=a.startsWith(".");if(void 0!==t)return l&&l[n]?void c(s,l,n,t,e?o:null):void 0;u&&Object.keys(l).forEach(e=>{{var n=s,r=l,i=e,o=a.slice(1);let t=r[i]||{};Object.keys(t).forEach(e=>{e.includes(o)&&(e=t[e],c(n,r,i,e.originalHandler,e.delegationSelector))})}});let i=l[n]||{};Object.keys(i).forEach(e=>{var t=e.replace(d,"");r&&!a.includes(t)||(t=i[e],c(s,l,n,t.originalHandler,t.delegationSelector))})}},trigger(e,t,n){if("string"!=typeof t||!e)return null;var r=m(),i=f(t),o=t!==i,l=h.has(i);let s,a=!0,u=!0,d=!1,c=null;return o&&r&&(s=r.Event(t,n),r(e).trigger(s),a=!s.isPropagationStopped(),u=!s.isImmediatePropagationStopped(),d=s.isDefaultPrevented()),l?(c=document.createEvent("HTMLEvents")).initEvent(i,a,!0):c=new CustomEvent(t,{bubbles:a,cancelable:!0}),void 0!==n&&Object.keys(n).forEach(e=>{Object.defineProperty(c,e,{get(){return n[e]}})}),d&&c.preventDefault(),u&&e.dispatchEvent(c),c.defaultPrevented&&void 0!==s&&s.preventDefault(),c}};return _}(h.index.getjQuery),h.Backdrop=function(e,t,n,r,i,o){let l={isVisible:!0,isAnimated:!1,rootElement:"body",clickCallback:null},s={isVisible:"boolean",isAnimated:"boolean",rootElement:"(element|string)",clickCallback:"(function|null)"},a="backdrop",u="mousedown.bs."+a;return class{constructor(e){this._config=this._getConfig(e),this._isAppended=!1,this._element=null}show(e){this._config.isVisible?(this._append(),this._config.isAnimated&&i(this._getElement()),this._getElement().classList.add("show"),this._emulateAnimation(()=>{t(e)})):t(e)}hide(e){this._config.isVisible?(this._getElement().classList.remove("show"),this._emulateAnimation(()=>{this.dispose(),t(e)})):t(e)}_getElement(){var e;return this._element||((e=document.createElement("div")).className="modal-backdrop",this._config.isAnimated&&e.classList.add("fade"),this._element=e),this._element}_getConfig(e){return(e={...l,..."object"==typeof e?e:{}}).rootElement=r(e.rootElement),o(a,e,s),e}_append(){this._isAppended||(this._config.rootElement.appendChild(this._getElement()),e.on(this._getElement(),u,()=>{t(this._config.clickCallback)}),this._isAppended=!0)}dispose(){this._isAppended&&(e.off(this._element,u),this._element.remove(),this._isAppended=!1)}_emulateAnimation(e){n(e,this._getElement(),this._config.isAnimated)}}}(m.EventHandler,h.index.execute,h.index.executeAfterTransition,h.index.getElement,h.index.reflow,h.index.typeCheckConfig),h.sanitizer=function(){let a=new Set(["background","cite","href","itemtype","longdesc","poster","src","xlink:href"]);let u=/^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/i,d=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i;return{DefaultAllowlist:{"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","srcset","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},sanitizeHtml:function(e,r,t){if(!e.length)return e;if(t&&"function"==typeof t)return t(e);var t=(new window.DOMParser).parseFromString(e,"text/html"),i=Object.keys(r),o=[].concat(...t.body.querySelectorAll("*"));for(let e=0,t=o.length;e{((e,t)=>{var n=e.nodeName.toLowerCase();if(t.includes(n))return!a.has(n)||Boolean(u.test(e.nodeValue)||d.test(e.nodeValue));var r=t.filter(e=>e instanceof RegExp);for(let e=0,t=r.length;ee+t),this._element.style.setProperty("--scroll-bar-size",t+"px"),this._setElementAttributes(e,"paddingRight",e=>e+t),this._setElementAttributes(o,"marginRight",e=>e-t)}_disableOverFlow(){this._saveInitialAttribute(this._element,"overflow"),this._element.style.overflow="hidden"}_setElementAttributes(e,n,r){let i=this.getWidth();this._applyManipulationCallback(e,e=>{var t;e!==this._element&&window.innerWidth>e.clientWidth+i||(this._saveInitialAttribute(e,n),t=window.getComputedStyle(e)[n],e.style[n]=r(Number.parseFloat(t))+"px")})}reset(){this._resetElementAttributes(this._element,"overflow"),this._resetElementAttributes(this._element,"paddingRight"),this._resetElementAttributes(e,"paddingRight"),this._resetElementAttributes(o,"marginRight"),this._element.style.setProperty("--scroll-bar-size","0")}_saveInitialAttribute(e,t){var n=e.style[t];n&&r.setDataAttribute(e,t,n)}_resetElementAttributes(e,n){this._applyManipulationCallback(e,e=>{var t=r.getDataAttribute(e,n);void 0===t?e.style.removeProperty(n):(r.removeDataAttribute(e,n),e.style[n]=t)})}_applyManipulationCallback(e,t){i(e)?t(e):n.find(e,this._element).forEach(t)}isOverflowing(){return 0{var e="click.dismiss"+t.EVENT_KEY;let r=t.NAME;i.on(document,e,`[data-bs-dismiss="${r}"]`,function(e){["A","AREA"].includes(this.tagName)&&e.preventDefault(),l(this)||(e=o(this)||this.closest("."+r),t.getOrCreateInstance(e)[n]())})}}),d.BaseComponent=(r=m.Data,s=h.index.executeAfterTransition,a=h.index.getElement,u=m.EventHandler,class{constructor(e){(e=a(e))&&(this._element=e,r.set(this._element,this.constructor.DATA_KEY,this))}dispose(){r.remove(this._element,this.constructor.DATA_KEY),u.off(this._element,this.constructor.EVENT_KEY),Object.getOwnPropertyNames(this).forEach(e=>{this[e]=null})}_queueCallback(e,t,n=!0){s(e,t,n)}static getInstance(e){return r.get(e,this.DATA_KEY)}static getOrCreateInstance(e,t={}){return this.getInstance(e)||new this(e,"object"==typeof t?t:null)}static get VERSION(){return"5.0.2"}static get NAME(){throw new Error('You have to implement the static method "NAME", for each component!')}static get DATA_KEY(){return"bs."+this.NAME}static get EVENT_KEY(){return"."+this.DATA_KEY}}),d.util=h,d.dom=m,n.exports=d,n.exports}); \ No newline at end of file diff --git a/assets/bsToast/bsToast.js b/assets/bsToast/bsToast.js index 049232f..2c97622 100644 --- a/assets/bsToast/bsToast.js +++ b/assets/bsToast/bsToast.js @@ -259,7 +259,7 @@ __PluginManager__.register('bsToast', function(require, exports, module){ /** - * @memberOf kit + * @memberOf {kit} * @class bsToast **/ var bsToast = Toast; diff --git a/assets/bsToast/bsToast.min.js b/assets/bsToast/bsToast.min.js new file mode 100644 index 0000000..8d9b1e5 --- /dev/null +++ b/assets/bsToast/bsToast.min.js @@ -0,0 +1 @@ +__PluginManager__.register("bsToast",function(e,t,i){var e=e("bsCore"),s=e.util.index.defineJQueryPlugin,n=(e.util.index.getElementFromSelector,e.util.index.isRTL,e.util.index.isVisible,e.util.index.reflow),o=e.util.index.typeCheckConfig,a=e.dom.EventHandler,l=e.dom.Manipulator,r=(e.dom.SelectorEngine,e.util.index.getSelector,e.util.index.isDisabled,e.util.componentFunctions.enableDismissTrigger),h=(e.util.ScrollBarHelper,e.BaseComponent),e=(e.util.Backdrop,e=>e&&"object"==typeof e&&"default"in e?e:{default:e});let u=e(a),c=e(l);a=e(h);let d="toast";let m="hide",_="show",f="showing",g={animation:"boolean",autohide:"boolean",delay:"number"},b={animation:!0,autohide:!0,delay:5e3};class p extends a.default{constructor(e,t){super(e),this._config=this._getConfig(t),this._timeout=null,this._hasMouseInteraction=!1,this._hasKeyboardInteraction=!1,this._setListeners()}static get DefaultType(){return g}static get Default(){return b}static get NAME(){return d}show(){u.default.trigger(this._element,"show.bs.toast").defaultPrevented||(this._clearTimeout(),this._config.animation&&this._element.classList.add("fade"),this._element.classList.remove(m),n(this._element),this._element.classList.add(_),this._element.classList.add(f),this._queueCallback(()=>{this._element.classList.remove(f),u.default.trigger(this._element,"shown.bs.toast"),this._maybeScheduleHide()},this._element,this._config.animation))}hide(){this._element.classList.contains(_)&&!u.default.trigger(this._element,"hide.bs.toast").defaultPrevented&&(this._element.classList.add(f),this._queueCallback(()=>{this._element.classList.add(m),this._element.classList.remove(f),this._element.classList.remove(_),u.default.trigger(this._element,"hidden.bs.toast")},this._element,this._config.animation))}dispose(){this._clearTimeout(),this._element.classList.contains(_)&&this._element.classList.remove(_),super.dispose()}_getConfig(e){return e={...b,...c.default.getDataAttributes(this._element),..."object"==typeof e&&e?e:{}},o(d,e,this.constructor.DefaultType),e}_maybeScheduleHide(){!this._config.autohide||this._hasMouseInteraction||this._hasKeyboardInteraction||(this._timeout=setTimeout(()=>{this.hide()},this._config.delay))}_onInteraction(e,t){switch(e.type){case"mouseover":case"mouseout":this._hasMouseInteraction=t;break;case"focusin":case"focusout":this._hasKeyboardInteraction=t}t?this._clearTimeout():(e=e.relatedTarget,this._element===e||this._element.contains(e)||this._maybeScheduleHide())}_setListeners(){u.default.on(this._element,"mouseover.bs.toast",e=>this._onInteraction(e,!0)),u.default.on(this._element,"mouseout.bs.toast",e=>this._onInteraction(e,!1)),u.default.on(this._element,"focusin.bs.toast",e=>this._onInteraction(e,!0)),u.default.on(this._element,"focusout.bs.toast",e=>this._onInteraction(e,!1))}_clearTimeout(){clearTimeout(this._timeout),this._timeout=null}static jQueryInterface(t){return this.each(function(){var e=p.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t](this)}})}}r(p),s(p);p;return i.exports=p,i.exports}); \ No newline at end of file diff --git a/assets/core/core.js b/assets/core/core.js index ffaec04..051454f 100644 --- a/assets/core/core.js +++ b/assets/core/core.js @@ -1,4 +1,5 @@ -window.kit = window.kit || {}; +var kit; +kit = window.kit = window.kit || {}; kit.service = kit.service || {}; kit.config = kit.config || {}; @@ -36,7 +37,6 @@ kit.config = kit.config || {}; default: 'default', }; /** - * @memberOf kit * @param pluginId * @param config * @constructor @@ -606,7 +606,7 @@ kit.config = kit.config || {}; list.forEach(function(item, i, array){ if(Array.isArray(item)) { p = p.then(function () { - return self.getAsyncScriptListPromise(item); + return self.getAsyncScriptListPromise(item.map((src) => self.config.path + src)); }); } else { p = p.then(function () { @@ -666,6 +666,7 @@ kit.config = kit.config || {}; this.global = global; }; + var __proto = PluginManager.prototype; /** * @param plugins * @return {PluginManager} @@ -758,7 +759,13 @@ kit.config = kit.config || {}; }; /** - * @memberOf kit + * @typedef PluginManager.exec + * + * @param deps + * @param callback + * @param argArr + * @param context + * @returns {undefined} */ PluginManager.prototype.exec = function (deps, callback, argArr = [], context = undefined) { var self = this; @@ -796,7 +803,7 @@ kit.config = kit.config || {}; } }; - PluginManager.prototype.exec2 = function (deps, callback) { + __proto.exec2 = function (deps, callback) { var self = this; var context = this; @@ -825,12 +832,12 @@ kit.config = kit.config || {}; }; /** + * @typedef PluginManager.ready + * * @param {(string|string[])} deps * @param {function} callback - * @memberOf kit */ - - PluginManager.prototype.ready = function(deps, callback = undefined) { + __proto.ready = function(deps, callback = undefined) { var self = this; if(typeof deps === 'function') { callback = deps; @@ -841,7 +848,8 @@ kit.config = kit.config || {}; } self.__ready(self.exec, [deps, callback], self); }; - PluginManager.prototype.__ready = function(fn, args = [], context = window) { + + __proto.__ready = function(fn, args = [], context = window) { var self = this; context = context || this; if (/complete|interactive|loaded/.test(document.readyState)) { @@ -852,13 +860,14 @@ kit.config = kit.config || {}; }.bind(this)); } }; + /** + * @typedef PluginManager.loaded + * * @param {(string|string[])} deps * @param {function} callback - * @memberOf kit */ - - PluginManager.prototype.loaded = function(deps, callback = undefined) { + __proto.loaded = function(deps, callback = undefined) { var self = this; if(typeof deps === 'function') { callback = deps; @@ -869,7 +878,8 @@ kit.config = kit.config || {}; } self.__loaded(self.exec, [deps, callback], self); }; - PluginManager.prototype.__loaded = function(fn, args = [], context = window) { + + __proto.__loaded = function(fn, args = [], context = window) { var self = this; context = context || this; if (/complete|interactive|loaded/.test(document.readyState)) { @@ -881,7 +891,15 @@ kit.config = kit.config || {}; } }; - PluginManager.prototype.require = function (pluginId, callback) { + /** + * @typedef PluginManager.require + * + * @param pluginId + * @param callback + * @returns {undefined|*} + * + */ + __proto.require = function (pluginId, callback) { var plugin = this.__getPlugin(pluginId); if(!plugin) { @@ -900,7 +918,14 @@ kit.config = kit.config || {}; return module.exports; }; - PluginManager.prototype.install = function (pluginId, callback) { + /** + * @typedef PluginManager.install + * + * @param pluginId + * @param callback + * @returns {undefined} + */ + __proto.install = function (pluginId, callback) { var plugin = this.__getPlugin(pluginId); if(!plugin) { @@ -916,9 +941,25 @@ kit.config = kit.config || {}; function init(global){ var manager = new PluginManager(global); + /** + * @type {PluginManager.ready} + * @memberOf kit + */ global.ready = manager.ready.bind(manager); + /** + * @type {PluginManager.loaded} + * @memberOf kit + */ global.loaded = manager.loaded.bind(manager); + /** + * @type {PluginManager.exec} + * @memberOf kit + */ global.exec = manager.exec.bind(manager); + /** + * @type {PluginManager.require} + * @memberOf kit + */ global.require = manager.require.bind(manager); manager.register('pluginManager', { alias: 'pm', @@ -956,19 +997,17 @@ kit.config = kit.config || {}; } var config = global.config || {}; - config = Object.assign({}, defaultConfig, config); + global.config = Object.assign({}, defaultConfig, config); if(typeof window === 'object'){ - window.__pmConfig__ = global.config = config; + window.__pmConfig__ = global.config; } - (function(){ - document.addEventListener("DOMContentLoaded", function () { - console.log('%cDOMContentLoaded', 'color:#2053ff'); - }); - window.addEventListener("load", (event) => { - console.log('%cWindowLoaded', 'color:#2053ff'); - }); - }()); + document.addEventListener("DOMContentLoaded", function () { + console.log('%cDOMContentLoaded', 'color:#2053ff'); + }); + window.addEventListener("load", (event) => { + console.log('%cWindowLoaded', 'color:#2053ff'); + }); }, onInstall: function(plugin){ if(typeof window === 'object'){ diff --git a/assets/core/core.min.js b/assets/core/core.min.js index bc7d8ef..e5c21e7 100644 --- a/assets/core/core.min.js +++ b/assets/core/core.min.js @@ -1 +1 @@ -window.kit=window.kit||{},kit.service=kit.service||{},kit.config=kit.config||{},!function(global){var defaultConfig={version:"2.0",assetsPath:"",requiredDependencies:[],autoloadPluginList:[],debug:!0},stateList={undefined:0,registered:1,loading:3,loaded:4,installing:5,installed:6},MD_TYPE={ES:"ES",UMD:"UMD",HMD:"HMD",default:"default"};function Plugin(e,t={}){this.id=e,this.state=stateList.undefined,this.state2=stateList.undefined,this.module={code:"",exports:{}},this.config={autoRequire:!1,loadJsAfterModule:!1,isSetTimestamp:!0,path:"",module:"",type:"default",handler:void 0,onRegister:function(e){},onLoad:function(e){},onInstall:function(e){},js:[],css:[],alias:[],deps:[],debug:!1},this.pluginManager=void 0,this.promise=new Promise(function(e,t){e()}),this.errors=[],this.register(t)}function isAssetLoaded(e){return e=e.match(/^[^#?]*/)[0],document.querySelector('script[src^="'+e+'"]')||document.querySelector('link[href^="'+e+'"]')||document.querySelector('meta[property="kit:file-load"][content="'+e+'"]')}function getUrlWithTimestamp(t){var n=3600*((new Date).getTime()/1e3/3600>>0);try{var e=new URL(t);e.searchParams.append("__pm",String(n)),t=e.toString()}catch(e){t=(t=String(t).split("?")[0])+"?__pm"+n}return t}Plugin.prototype.setPluginManager=function(e){this.pluginManager=e},Plugin.prototype.queuePush=function(n,i=[]){"function"==typeof n&&(this.promise=this.promise.then(function(e){var t=n.apply(this,i);if(t)return t}))},Plugin.prototype.__queue=function(e,n,i=[],o=void 0){var t=this;void 0===o&&(o=t),t.__checkState(e)?n.apply(o,i):t.promise=t.promise.then(function(){return new Promise(function(e,t){n.apply(o,i),e()})}.bind(t))},Plugin.prototype.__exec=function(e,t,n=[],i=void 0){var o=this;void 0===i&&(i=o),o.__checkState(e)?t.apply(i,n):o.promise=o.promise.then(function(){t.apply(i,n)}.bind(o))},Plugin.prototype.__checkState=function(e,t=void 0){return void 0===t?this.state>=e:this.state>=e&&this.state<=t},Plugin.prototype.__check2State=function(e,t=void 0){return void 0===t?this.state2>=e:this.state2>=e&&this.state2<=t},Plugin.prototype.__getValidConfig=function(e={}){e=Object.assign({},e);return"function"!=typeof e.onLoad&&(e.onLoad=function(e){}),"function"!=typeof e.onInstall&&(e.onInstall=function(e){}),"function"!=typeof e.onRegister&&(e.onRegister=function(e){}),"string"!=typeof e.path&&(e.path=""),"string"==typeof e.js?e.js=[e.js]:Array.isArray(e.js)||(e.js=[]),"string"==typeof e.css?e.css=[e.css]:Array.isArray(e.css)||(e.css=[]),"string"==typeof e.alias?e.alias=[e.alias]:Array.isArray(e.alias)||(e.alias=[]),e.autoRequire=!!e.hasOwnProperty("autoRequire")&&!!e.autoRequire,e.loadJsAfterModule=!!e.hasOwnProperty("loadJsAfterModule")&&!!e.loadJsAfterModule,e.isSetTimestamp=!e.hasOwnProperty("isSetTimestamp")||!!e.isSetTimestamp,e.type=e.type||"default","string"==typeof e.deps?e.deps=[e.deps]:Array.isArray(e.deps)||(e.deps=[]),e},Plugin.prototype.__setState=function(e,t=!1){var n=this;(t||n.__checkState(e))&&(n.state=e)},Plugin.prototype.register=function(e={}){var t,n=this,i=n.id;if(this.__checkState(stateList.installed))throw new Error("Plugin "+i+" уже невозможно конфигурировать ("+n.state+"/"+n.state2+")");if("function"==typeof e)t=e,(e=this.config).handler=t,e.type=MD_TYPE.HMD;else{if(this.__checkState(stateList.loaded)||this.__check2State(stateList.loading))throw new Error("Plugin "+i+" уже невозможно конфигурировать ("+n.state+")");if("object"!=typeof e)throw new Error("Plugin.register: plugin "+i+" is not a valid format");e=this.__getValidConfig(e),Object.assign(this.config,e)}this.__checkState(stateList.registered)||(n.config.debug&&console.log(`Plugin ${n.id}: onRegister + event.`),this.state=stateList.registered,this.config.onRegister(this),t=new CustomEvent("onRegister"+this.id+"Plugin",{detail:{plugin:this}}),document.dispatchEvent(t)),e.autoRequire},Plugin.prototype.load=function(e){var i,t,n,o,s,r=this,l=("function"!=typeof e&&(e=function(){}),r.id);return r.__checkState(stateList.registered)?r.__checkState(stateList.loaded)?e():r.__check2State(stateList.loading)?r.__exec(stateList.loaded,e):(r.state2=stateList.loading,(i=r.config).css.forEach(function(e,t,n){r.getStylePromise(i.path+e)}),r.pluginManager&&(t=r.pluginManager.__getDepsPromiseCallback(r.config.deps),r.queuePush(t)),o=i.path+i.module,n="string"==typeof i.module&&""!==i.module&&"ES"===i.type?function(){return r.getESModulePromise(o).then(function(e){e.__esModule=!0,r.module.exports=e}.bind(r))}:"string"==typeof i.module&&""!==i.module&&"UMD"===i.type?isAssetLoaded(o)?void(r.config.debug&&console.warn(`Plugin ${r.id}: Скрипт ${o} уже загружен!`)):function(){return r.httpGet(o).then(function(e){r.module.code=e}.bind(r))}:"HMD"!==i.type||i.hasOwnProperty("handler")&&"function"==typeof i.handler?"string"==typeof i.module&&""!==i.module&&"default"===i.type?isAssetLoaded(o)?void(r.config.debug&&console.warn(`Plugin ${r.id}: Скрипт ${o} уже загружен!`)):function(){return r.getScriptPromise(o)}:void 0:function(){return r.getScriptPromise(o)},s=r.getJsAssetsPromiseCallback(i.js),i.loadJsAfterModule?(r.queuePush(n),r.queuePush(s)):(r.queuePush(s),r.queuePush(n)),t||n||s||(r.state=stateList.loaded),r.__queue(stateList.loaded,function(){r.config.debug&&console.log(`Plugin ${r.id}: onLoad + event.`),r.isLoaded()||(r.state=stateList.loaded),i.onLoad.call(r,r);var e=new CustomEvent("onLoad"+r.id+"Plugin",{detail:{plugin:r}});document.dispatchEvent(e)}),r.__exec(stateList.loaded,function(){e()}.bind(r))):console.warn(`Plugin.load(${l}): is not register!.`),r},Plugin.prototype.install=function(callback){var self=this,global=self.pluginManager.global,require=self.pluginManager.require.bind(self.pluginManager),pluginId=("function"!=typeof callback&&(callback=function(){}),self.id),setGlobals,module,installer;return self.__checkState(stateList.registered)?self.__checkState(stateList.installed)?callback():self.__check2State(stateList.installing)?self.__exec(stateList.installed,callback):(self.__checkState(stateList.loaded)||this.load(),self.state2=stateList.installing,setGlobals=function(t,n){var e,i;void 0!==n&&(e=self.id,i=self.config.alias,t.hasOwnProperty(e)||(t[e]=n),Array.isArray(i))&&i.length&&i.forEach(function(e){t.hasOwnProperty(e)||(t[e]=n)})},module=self.module,installer=function(){var __exports=void 0,event=("ES"===self.config.type&&"string"==typeof self.config.module&&""!==self.config.module?__exports="object"==typeof self.module.exports&&void 0!==self.module.exports.default?self.module.exports.default:self.module.exports:"UMD"===self.config.type&&"string"==typeof self.config.module&&""!==self.config.module?(function(require,exports,module,global){var self=global;eval(module.code)}.bind(global).call(global,require,self.module.exports,module,global),__exports="object"==typeof self.module.exports&&void 0!==self.module.exports.default?self.module.exports.default:self.module.exports):"HMD"===self.config.type&&"function"==typeof self.config.handler&&(__exports=self.config.handler.bind(global).call(global,require,self.module.exports,module,global),void 0===__exports)&&self.module.exports&&(__exports=self.module.exports),"object"==typeof global&&setGlobals(global,__exports),self.state=stateList.installed,console.log(`%cPlugin ${pluginId}: installed.`,"color: green;"),self.config.onInstall.call(self,self),new CustomEvent("onInstall"+self.id+"Plugin",{detail:{plugin:self}}));return document.dispatchEvent(event),!0}.bind(this),this.__queue(stateList.loaded,installer),this.__exec(stateList.loaded,function(){callback()})):console.warn(`Plugin ${pluginId}: is not register!`),self},Plugin.prototype.exec=function(e,t=[],n=void 0){var i=this;void 0===n&&(n=i),i.__checkState(stateList.installed)||(i.load(),i.install()),i.__exec(stateList.installed,e,t,n)},Plugin.prototype.getESModulePromise=function(e){var i=this;return new Promise(function(t,n){import(e).then(function(e){t(e)},function(e){i.errors.push(e),console.log(`%cPlugin ${i.id}: error import module!`,"color: red;"),n(e)})})},Plugin.prototype.httpGet=function(o){var s=this;return new Promise(function(t,n){s.config.debug&&console.log(`Plugin ${s.id}: httpGet `+o);var e=new XMLHttpRequest,i=o;s.config.isSetTimestamp&&(i=getUrlWithTimestamp(o)),e.open("GET",i,!0),e.onload=function(){var e;200==this.status?t(this.response):(console.log(`%cPlugin.load(${s.id}): error load file!`,"color: red;"),(e=new Error(this.statusText)).code=this.status,n(e))},e.onerror=function(){console.log(`%cPlugin.load(${s.id}): error load file!`,"color: red;"),n(new Error("Network Error"))},e.send()})},Plugin.prototype.getScriptPromise=function(i){var o=this;if(!isAssetLoaded(i))return new Promise(function(e,t){o.config.debug&&console.log(`Plugin ${o.id}: load script `+i);var n=document.createElement("script");n.src=i,o.config.isSetTimestamp&&(n.src=getUrlWithTimestamp(i)),n.onload=function(){e(n)},n.onerror=function(){var e=new Error("Ошибка загрузки скрипта "+i);o.errors.push(e),console.log(`%cPlugin.load(${o.id}): error load script ${i}!`,"color: red;"),t(e)},document.head.append(n)});o.config.debug&&console.warn(`Plugin ${o.id}: Скрипт ${i} уже загружен!`)},Plugin.prototype.getStylePromise=function(i){var o=this;return new Promise(function(e,t){var n;isAssetLoaded(i)?(o.config.debug&&console.warn(`Plugin ${o.id}: Стиль ${i} уже загружен`),e()):((n=document.createElement("link")).rel="stylesheet",n.type="text/css",n.media="all",n.href=i,o.config.isSetTimestamp&&(n.href=getUrlWithTimestamp(i)),document.head.append(n),e(n))})},Plugin.prototype.getAsyncScriptListPromise=function(e){e=e.map(this.getScriptPromise.bind(this)).filter(e=>void 0!==e);if(e.length)return Promise.all(e)},Plugin.prototype.getJsAssetsPromiseCallback=function(e=[]){var o=this;if(e.length)return function(){var i=new Promise(function(e,t){e()});return e.forEach(function(e,t,n){i=Array.isArray(e)?i.then(function(){return o.getAsyncScriptListPromise(e)}):i.then(function(){return o.getScriptPromise(o.config.path+e)})}),i}},Plugin.prototype.__getRealId=function(e){var t,n=e.toLowerCase();if(this.id.toLowerCase()===n)return this.id;for(t of this.config.alias)if(n===t.toLowerCase())return this.id},Plugin.prototype.__is=function(e){return this.id===this.__getRealId(e)},Plugin.prototype.isLoaded=function(){return this.__checkState(stateList.loaded)},Plugin.prototype.isInstalled=function(){return this.__checkState(stateList.installed)},Plugin.prototype.require=function(){return this.isInstalled()||this.config.debug&&console.warn(`Plugin ${this.id}: not instaled!`),this.module.exports};var PluginManager=function(e){this.plugins={},this.global=e};function init(e){var o=new PluginManager(e);e.ready=o.ready.bind(o),e.loaded=o.loaded.bind(o),e.exec=o.exec.bind(o),e.require=o.require.bind(o),o.register("pluginManager",{alias:"pm",type:MD_TYPE.HMD,handler:function(e,t,n,i){return i.PluginManagerClass=PluginManager,"object"==typeof window&&(window.__PluginManager__=o,window.__pmGlobal__=i),n.exports=o},onInstall:function(e){}}),o.install("pluginManager"),o.register("config",{type:MD_TYPE.HMD,handler:function(e,t,n,i){var o=document.currentScript;if(o)try{var s=new URL(o.src);defaultConfig.assetsPath=s.pathname.split("/").slice(0,-2).join("/")}catch(e){s=o.src.split("?")[0];defaultConfig.assetsPath=s.split("/").slice(0,-2).join("/")}o=i.config||{},o=Object.assign({},defaultConfig,o);"object"==typeof window&&(window.__pmConfig__=i.config=o),document.addEventListener("DOMContentLoaded",function(){console.log("%cDOMContentLoaded","color:#2053ff")}),window.addEventListener("load",e=>{console.log("%cWindowLoaded","color:#2053ff")})},onInstall:function(e){"object"==typeof window&&window.hasOwnProperty("__PluginManagerConfigHandler__")&&"function"==typeof __PluginManagerConfigHandler__&&o.registerPlugins(__PluginManagerConfigHandler__())}}),o.install("config")}PluginManager.prototype.registerPlugins=function(e){for(var t in e)e.hasOwnProperty(t)&&this.register(t,e[t]);return this},PluginManager.prototype.register=function(e,t={}){var n;"string"!=typeof e||""===e?console.warn("Invalid pluginId!",e):(n=this.__getPlugin(e))?n.register(t):((n=new Plugin(e,t)).setPluginManager(this),this.plugins[e]=n)},PluginManager.prototype.__getPlugin=function(e){var t,n;for(t in this.plugins)if(this.plugins.hasOwnProperty(t)&&(n=this.plugins[t]).__is(e))return n},PluginManager.prototype.__getDepsPromiseCallback=function(e=[]){var n=this,t=e.map(function(e){var t=n.__getPlugin(e);if(t)return t.install(),t.isInstalled()?void 0:t.promise;console.log(`%cPluginManager: plugin ${e} not found!`,"color: red;")}).filter(e=>void 0!==e);if(t.length)return function(){return Promise.all(t)}},PluginManager.prototype.__getRealIdList=function(e=[]){var t=this;return e.map(function(e){e=t.__getPlugin(e);if(e)return e.id})},PluginManager.prototype.exec=function(e,t,n=[],i=void 0){"function"==typeof e&&(i=n,n=t,t=e,e=[]),"string"==typeof e&&(e=[e]),void 0===i&&(i=this),void 0===n&&(n=[]),"function"==typeof t&&(global.config&&global.config.requiredDependencies&&(e=Array.from(new Set(e.concat(global.config.requiredDependencies)))),(e=this.__getDepsPromiseCallback(e))?e().then(function(){t.apply(i,n)}):t.apply(i,n))},PluginManager.prototype.exec2=function(e,t){var n=this,i=this,o=n.__getDepsPromiseCallback(e),s=function(){var t=[];return e.forEach(function(e){n.__getPlugin(e)?t.push(n.require(e)):t.push(void 0)}.bind(n)),t}.bind(n);o?o().then(function(){t.apply(i,s())}):t.apply(i,s())},PluginManager.prototype.ready=function(e,t=void 0){"function"==typeof e&&(t=e,e=[]),this.__ready(this.exec,[e,t="function"!=typeof t?function(){}:t],this)},PluginManager.prototype.__ready=function(e,t=[],n=window){n=n||this,/complete|interactive|loaded/.test(document.readyState)?e.apply(n,t):document.addEventListener("DOMContentLoaded",function(){e.apply(n,t)}.bind(this))},PluginManager.prototype.loaded=function(e,t=void 0){"function"==typeof e&&(t=e,e=[]),this.__loaded(this.exec,[e,t="function"!=typeof t?function(){}:t],this)},PluginManager.prototype.__loaded=function(e,t=[],n=window){n=n||this,/complete|interactive|loaded/.test(document.readyState)?e.apply(n,t):window.addEventListener("load",function(){e.apply(n,t)}.bind(this))},PluginManager.prototype.require=function(e,t){var n,i=this.__getPlugin(e);if(i)return e=i.id,n=i.module,i.install(t="function"!=typeof t?function(){}:t),n.exports;console.warn("PluginManager.require: plugin "+e+" not found!")},PluginManager.prototype.install=function(e,t){var n=this.__getPlugin(e);n?(e=n.id,n.module,n.install(t)):console.warn("PluginManager.install: plugin "+e+" not found!")},init(global)}(kit); \ No newline at end of file +var kit,kit=window.kit=window.kit||{};kit.service=kit.service||{},kit.config=kit.config||{},!function(global){var defaultConfig={version:"2.0",assetsPath:"",requiredDependencies:[],autoloadPluginList:[],debug:!0},stateList={undefined:0,registered:1,loading:3,loaded:4,installing:5,installed:6},MD_TYPE={ES:"ES",UMD:"UMD",HMD:"HMD",default:"default"};function Plugin(e,t={}){this.id=e,this.state=stateList.undefined,this.state2=stateList.undefined,this.module={code:"",exports:{}},this.config={autoRequire:!1,loadJsAfterModule:!1,isSetTimestamp:!0,path:"",module:"",type:"default",handler:void 0,onRegister:function(e){},onLoad:function(e){},onInstall:function(e){},js:[],css:[],alias:[],deps:[],debug:!1},this.pluginManager=void 0,this.promise=new Promise(function(e,t){e()}),this.errors=[],this.register(t)}function isAssetLoaded(e){return e=e.match(/^[^#?]*/)[0],document.querySelector('script[src^="'+e+'"]')||document.querySelector('link[href^="'+e+'"]')||document.querySelector('meta[property="kit:file-load"][content="'+e+'"]')}function getUrlWithTimestamp(t){var i=3600*((new Date).getTime()/1e3/3600>>0);try{var e=new URL(t);e.searchParams.append("__pm",String(i)),t=e.toString()}catch(e){t=(t=String(t).split("?")[0])+"?__pm"+i}return t}Plugin.prototype.setPluginManager=function(e){this.pluginManager=e},Plugin.prototype.queuePush=function(i,n=[]){"function"==typeof i&&(this.promise=this.promise.then(function(e){var t=i.apply(this,n);if(t)return t}))},Plugin.prototype.__queue=function(e,i,n=[],o=void 0){var t=this;void 0===o&&(o=t),t.__checkState(e)?i.apply(o,n):t.promise=t.promise.then(function(){return new Promise(function(e,t){i.apply(o,n),e()})}.bind(t))},Plugin.prototype.__exec=function(e,t,i=[],n=void 0){var o=this;void 0===n&&(n=o),o.__checkState(e)?t.apply(n,i):o.promise=o.promise.then(function(){t.apply(n,i)}.bind(o))},Plugin.prototype.__checkState=function(e,t=void 0){return void 0===t?this.state>=e:this.state>=e&&this.state<=t},Plugin.prototype.__check2State=function(e,t=void 0){return void 0===t?this.state2>=e:this.state2>=e&&this.state2<=t},Plugin.prototype.__getValidConfig=function(e={}){e=Object.assign({},e);return"function"!=typeof e.onLoad&&(e.onLoad=function(e){}),"function"!=typeof e.onInstall&&(e.onInstall=function(e){}),"function"!=typeof e.onRegister&&(e.onRegister=function(e){}),"string"!=typeof e.path&&(e.path=""),"string"==typeof e.js?e.js=[e.js]:Array.isArray(e.js)||(e.js=[]),"string"==typeof e.css?e.css=[e.css]:Array.isArray(e.css)||(e.css=[]),"string"==typeof e.alias?e.alias=[e.alias]:Array.isArray(e.alias)||(e.alias=[]),e.autoRequire=!!e.hasOwnProperty("autoRequire")&&!!e.autoRequire,e.loadJsAfterModule=!!e.hasOwnProperty("loadJsAfterModule")&&!!e.loadJsAfterModule,e.isSetTimestamp=!e.hasOwnProperty("isSetTimestamp")||!!e.isSetTimestamp,e.type=e.type||"default","string"==typeof e.deps?e.deps=[e.deps]:Array.isArray(e.deps)||(e.deps=[]),e},Plugin.prototype.__setState=function(e,t=!1){var i=this;(t||i.__checkState(e))&&(i.state=e)},Plugin.prototype.register=function(e={}){var t,i=this,n=i.id;if(this.__checkState(stateList.installed))throw new Error("Plugin "+n+" уже невозможно конфигурировать ("+i.state+"/"+i.state2+")");if("function"==typeof e)t=e,(e=this.config).handler=t,e.type=MD_TYPE.HMD;else{if(this.__checkState(stateList.loaded)||this.__check2State(stateList.loading))throw new Error("Plugin "+n+" уже невозможно конфигурировать ("+i.state+")");if("object"!=typeof e)throw new Error("Plugin.register: plugin "+n+" is not a valid format");e=this.__getValidConfig(e),Object.assign(this.config,e)}this.__checkState(stateList.registered)||(i.config.debug&&console.log(`Plugin ${i.id}: onRegister + event.`),this.state=stateList.registered,this.config.onRegister(this),t=new CustomEvent("onRegister"+this.id+"Plugin",{detail:{plugin:this}}),document.dispatchEvent(t)),e.autoRequire},Plugin.prototype.load=function(e){var n,t,i,o,s,r=this,l=("function"!=typeof e&&(e=function(){}),r.id);return r.__checkState(stateList.registered)?r.__checkState(stateList.loaded)?e():r.__check2State(stateList.loading)?r.__exec(stateList.loaded,e):(r.state2=stateList.loading,(n=r.config).css.forEach(function(e,t,i){r.getStylePromise(n.path+e)}),r.pluginManager&&(t=r.pluginManager.__getDepsPromiseCallback(r.config.deps),r.queuePush(t)),o=n.path+n.module,i="string"==typeof n.module&&""!==n.module&&"ES"===n.type?function(){return r.getESModulePromise(o).then(function(e){e.__esModule=!0,r.module.exports=e}.bind(r))}:"string"==typeof n.module&&""!==n.module&&"UMD"===n.type?isAssetLoaded(o)?void(r.config.debug&&console.warn(`Plugin ${r.id}: Скрипт ${o} уже загружен!`)):function(){return r.httpGet(o).then(function(e){r.module.code=e}.bind(r))}:"HMD"!==n.type||n.hasOwnProperty("handler")&&"function"==typeof n.handler?"string"==typeof n.module&&""!==n.module&&"default"===n.type?isAssetLoaded(o)?void(r.config.debug&&console.warn(`Plugin ${r.id}: Скрипт ${o} уже загружен!`)):function(){return r.getScriptPromise(o)}:void 0:function(){return r.getScriptPromise(o)},s=r.getJsAssetsPromiseCallback(n.js),n.loadJsAfterModule?(r.queuePush(i),r.queuePush(s)):(r.queuePush(s),r.queuePush(i)),t||i||s||(r.state=stateList.loaded),r.__queue(stateList.loaded,function(){r.config.debug&&console.log(`Plugin ${r.id}: onLoad + event.`),r.isLoaded()||(r.state=stateList.loaded),n.onLoad.call(r,r);var e=new CustomEvent("onLoad"+r.id+"Plugin",{detail:{plugin:r}});document.dispatchEvent(e)}),r.__exec(stateList.loaded,function(){e()}.bind(r))):console.warn(`Plugin.load(${l}): is not register!.`),r},Plugin.prototype.install=function(callback){var self=this,global=self.pluginManager.global,require=self.pluginManager.require.bind(self.pluginManager),pluginId=("function"!=typeof callback&&(callback=function(){}),self.id),setGlobals,module,installer;return self.__checkState(stateList.registered)?self.__checkState(stateList.installed)?callback():self.__check2State(stateList.installing)?self.__exec(stateList.installed,callback):(self.__checkState(stateList.loaded)||this.load(),self.state2=stateList.installing,setGlobals=function(t,i){var e,n;void 0!==i&&(e=self.id,n=self.config.alias,t.hasOwnProperty(e)||(t[e]=i),Array.isArray(n))&&n.length&&n.forEach(function(e){t.hasOwnProperty(e)||(t[e]=i)})},module=self.module,installer=function(){var __exports=void 0,event=("ES"===self.config.type&&"string"==typeof self.config.module&&""!==self.config.module?__exports="object"==typeof self.module.exports&&void 0!==self.module.exports.default?self.module.exports.default:self.module.exports:"UMD"===self.config.type&&"string"==typeof self.config.module&&""!==self.config.module?(function(require,exports,module,global){var self=global;eval(module.code)}.bind(global).call(global,require,self.module.exports,module,global),__exports="object"==typeof self.module.exports&&void 0!==self.module.exports.default?self.module.exports.default:self.module.exports):"HMD"===self.config.type&&"function"==typeof self.config.handler&&(__exports=self.config.handler.bind(global).call(global,require,self.module.exports,module,global),void 0===__exports)&&self.module.exports&&(__exports=self.module.exports),"object"==typeof global&&setGlobals(global,__exports),self.state=stateList.installed,console.log(`%cPlugin ${pluginId}: installed.`,"color: green;"),self.config.onInstall.call(self,self),new CustomEvent("onInstall"+self.id+"Plugin",{detail:{plugin:self}}));return document.dispatchEvent(event),!0}.bind(this),this.__queue(stateList.loaded,installer),this.__exec(stateList.loaded,function(){callback()})):console.warn(`Plugin ${pluginId}: is not register!`),self},Plugin.prototype.exec=function(e,t=[],i=void 0){var n=this;void 0===i&&(i=n),n.__checkState(stateList.installed)||(n.load(),n.install()),n.__exec(stateList.installed,e,t,i)},Plugin.prototype.getESModulePromise=function(e){var n=this;return new Promise(function(t,i){import(e).then(function(e){t(e)},function(e){n.errors.push(e),console.log(`%cPlugin ${n.id}: error import module!`,"color: red;"),i(e)})})},Plugin.prototype.httpGet=function(o){var s=this;return new Promise(function(t,i){s.config.debug&&console.log(`Plugin ${s.id}: httpGet `+o);var e=new XMLHttpRequest,n=o;s.config.isSetTimestamp&&(n=getUrlWithTimestamp(o)),e.open("GET",n,!0),e.onload=function(){var e;200==this.status?t(this.response):(console.log(`%cPlugin.load(${s.id}): error load file!`,"color: red;"),(e=new Error(this.statusText)).code=this.status,i(e))},e.onerror=function(){console.log(`%cPlugin.load(${s.id}): error load file!`,"color: red;"),i(new Error("Network Error"))},e.send()})},Plugin.prototype.getScriptPromise=function(n){var o=this;if(!isAssetLoaded(n))return new Promise(function(e,t){o.config.debug&&console.log(`Plugin ${o.id}: load script `+n);var i=document.createElement("script");i.src=n,o.config.isSetTimestamp&&(i.src=getUrlWithTimestamp(n)),i.onload=function(){e(i)},i.onerror=function(){var e=new Error("Ошибка загрузки скрипта "+n);o.errors.push(e),console.log(`%cPlugin.load(${o.id}): error load script ${n}!`,"color: red;"),t(e)},document.head.append(i)});o.config.debug&&console.warn(`Plugin ${o.id}: Скрипт ${n} уже загружен!`)},Plugin.prototype.getStylePromise=function(n){var o=this;return new Promise(function(e,t){var i;isAssetLoaded(n)?(o.config.debug&&console.warn(`Plugin ${o.id}: Стиль ${n} уже загружен`),e()):((i=document.createElement("link")).rel="stylesheet",i.type="text/css",i.media="all",i.href=n,o.config.isSetTimestamp&&(i.href=getUrlWithTimestamp(n)),document.head.append(i),e(i))})},Plugin.prototype.getAsyncScriptListPromise=function(e){e=e.map(this.getScriptPromise.bind(this)).filter(e=>void 0!==e);if(e.length)return Promise.all(e)},Plugin.prototype.getJsAssetsPromiseCallback=function(e=[]){var o=this;if(e.length)return function(){var n=new Promise(function(e,t){e()});return e.forEach(function(e,t,i){n=Array.isArray(e)?n.then(function(){return o.getAsyncScriptListPromise(e.map(e=>o.config.path+e))}):n.then(function(){return o.getScriptPromise(o.config.path+e)})}),n}},Plugin.prototype.__getRealId=function(e){var t,i=e.toLowerCase();if(this.id.toLowerCase()===i)return this.id;for(t of this.config.alias)if(i===t.toLowerCase())return this.id},Plugin.prototype.__is=function(e){return this.id===this.__getRealId(e)},Plugin.prototype.isLoaded=function(){return this.__checkState(stateList.loaded)},Plugin.prototype.isInstalled=function(){return this.__checkState(stateList.installed)},Plugin.prototype.require=function(){return this.isInstalled()||this.config.debug&&console.warn(`Plugin ${this.id}: not instaled!`),this.module.exports};var PluginManager=function(e){this.plugins={},this.global=e},__proto=PluginManager.prototype;function init(e){var o=new PluginManager(e);e.ready=o.ready.bind(o),e.loaded=o.loaded.bind(o),e.exec=o.exec.bind(o),e.require=o.require.bind(o),o.register("pluginManager",{alias:"pm",type:MD_TYPE.HMD,handler:function(e,t,i,n){return n.PluginManagerClass=PluginManager,"object"==typeof window&&(window.__PluginManager__=o,window.__pmGlobal__=n),i.exports=o},onInstall:function(e){}}),o.install("pluginManager"),o.register("config",{type:MD_TYPE.HMD,handler:function(e,t,i,n){var o=document.currentScript;if(o)try{var s=new URL(o.src);defaultConfig.assetsPath=s.pathname.split("/").slice(0,-2).join("/")}catch(e){s=o.src.split("?")[0];defaultConfig.assetsPath=s.split("/").slice(0,-2).join("/")}o=n.config||{};n.config=Object.assign({},defaultConfig,o),"object"==typeof window&&(window.__pmConfig__=n.config),document.addEventListener("DOMContentLoaded",function(){console.log("%cDOMContentLoaded","color:#2053ff")}),window.addEventListener("load",e=>{console.log("%cWindowLoaded","color:#2053ff")})},onInstall:function(e){"object"==typeof window&&window.hasOwnProperty("__PluginManagerConfigHandler__")&&"function"==typeof __PluginManagerConfigHandler__&&o.registerPlugins(__PluginManagerConfigHandler__())}}),o.install("config")}PluginManager.prototype.registerPlugins=function(e){for(var t in e)e.hasOwnProperty(t)&&this.register(t,e[t]);return this},PluginManager.prototype.register=function(e,t={}){var i;"string"!=typeof e||""===e?console.warn("Invalid pluginId!",e):(i=this.__getPlugin(e))?i.register(t):((i=new Plugin(e,t)).setPluginManager(this),this.plugins[e]=i)},PluginManager.prototype.__getPlugin=function(e){var t,i;for(t in this.plugins)if(this.plugins.hasOwnProperty(t)&&(i=this.plugins[t]).__is(e))return i},PluginManager.prototype.__getDepsPromiseCallback=function(e=[]){var i=this,t=e.map(function(e){var t=i.__getPlugin(e);if(t)return t.install(),t.isInstalled()?void 0:t.promise;console.log(`%cPluginManager: plugin ${e} not found!`,"color: red;")}).filter(e=>void 0!==e);if(t.length)return function(){return Promise.all(t)}},PluginManager.prototype.__getRealIdList=function(e=[]){var t=this;return e.map(function(e){e=t.__getPlugin(e);if(e)return e.id})},PluginManager.prototype.exec=function(e,t,i=[],n=void 0){"function"==typeof e&&(n=i,i=t,t=e,e=[]),"string"==typeof e&&(e=[e]),void 0===n&&(n=this),void 0===i&&(i=[]),"function"==typeof t&&(global.config&&global.config.requiredDependencies&&(e=Array.from(new Set(e.concat(global.config.requiredDependencies)))),(e=this.__getDepsPromiseCallback(e))?e().then(function(){t.apply(n,i)}):t.apply(n,i))},__proto.exec2=function(e,t){var i=this,n=this,o=i.__getDepsPromiseCallback(e),s=function(){var t=[];return e.forEach(function(e){i.__getPlugin(e)?t.push(i.require(e)):t.push(void 0)}.bind(i)),t}.bind(i);o?o().then(function(){t.apply(n,s())}):t.apply(n,s())},__proto.ready=function(e,t=void 0){"function"==typeof e&&(t=e,e=[]),this.__ready(this.exec,[e,t="function"!=typeof t?function(){}:t],this)},__proto.__ready=function(e,t=[],i=window){i=i||this,/complete|interactive|loaded/.test(document.readyState)?e.apply(i,t):document.addEventListener("DOMContentLoaded",function(){e.apply(i,t)}.bind(this))},__proto.loaded=function(e,t=void 0){"function"==typeof e&&(t=e,e=[]),this.__loaded(this.exec,[e,t="function"!=typeof t?function(){}:t],this)},__proto.__loaded=function(e,t=[],i=window){i=i||this,/complete|interactive|loaded/.test(document.readyState)?e.apply(i,t):window.addEventListener("load",function(){e.apply(i,t)}.bind(this))},__proto.require=function(e,t){var i,n=this.__getPlugin(e);if(n)return e=n.id,i=n.module,n.install(t="function"!=typeof t?function(){}:t),i.exports;console.warn("PluginManager.require: plugin "+e+" not found!")},__proto.install=function(e,t){var i=this.__getPlugin(e);i?(e=i.id,i.module,i.install(t)):console.warn("PluginManager.install: plugin "+e+" not found!")},init(global)}(kit); \ No newline at end of file diff --git a/assets/menu/menu.js b/assets/menu/menu.js index 391d7e0..ce759df 100644 --- a/assets/menu/menu.js +++ b/assets/menu/menu.js @@ -56,7 +56,6 @@ __PluginManager__.register('menu',function(require, exports, module, global) { /** - * @class kit.menu.Class * @param options * @param items */ diff --git a/assets/menu/menu.min.js b/assets/menu/menu.min.js new file mode 100644 index 0000000..ca9daca --- /dev/null +++ b/assets/menu/menu.min.js @@ -0,0 +1 @@ +__PluginManager__.register("menu",function(t,e,i,n){t("Collection"),t("Action");var o=t("userAction"),s=t("ActionCollection"),a=t("support"),r=t("Viewer"),h=t("align"),d=t("lib"),t=t("dataStructures");let c="menu",p="menuItem";var u={parent:null,eventType:"hint",animation:"",hideDelay:200,alignOffset:[0,0],click:function(t,e){console.log("Menu click")},hover:function(t,e){console.log("Menu hover")},dblclick:function(t,e){console.log("Menu dblclick")},hide:function(){}},l=[],f=0,v=function(t={},e=[]){this.id=++f,(l[this.id]=this).itemList={},this.node=null,this.bInit=!1,this.options=u,this.createNode(),this.setOptions(t),this.addItemList(e)};function m(t){var e=this;this.parentId=Number(t),this.node=Element,this.bInit=!1,this.bActive=!1,this.child=null,this.options={id:"",icon:d.svg.options,arrow:d.svg.arrowMenu,label:"menu",href:"javascript:void(0);",class:"",sort:500,visible:!0,hover:this.defaultHoverHandler,click:this.defaultClickHandler,dblclick:this.defaultDblClickHandler},this.handleEvent=function(t){switch(t.stopPropagation(),t.type){case"mouseover":this.options.hover(t,e,l[e.parentId]);break;case"click":this.options.click(t,e,l[e.parentId]);break;case"dblclick":this.options.dblclick(t,e,l[e.parentId])}},this.createNode()}v.prototype.getItemById=function(t){return!!this.itemList.hasOwnProperty(t)&&this.itemList[t]},v.prototype.getNode=function(){return this.node},v.prototype.getParent=function(){return this.options.parent},v.prototype.createNode=function(){this.node=document.createElement("div"),this.node.classList.add("kit-menu"),this.node.style.display="none",this.node.setAttribute("data-menu-id",this.id),a.setNodeData(this.node,c,this)},v.prototype.isActive=function(){return!!this.viewer&&this.viewer.isShown()},v.prototype.hide=function(t={}){return this.viewer&&this.viewer.hide(t),this},v.prototype.show=function(t={}){return this.viewer&&this.viewer.show(t),this},v.prototype.setPosition=function(){if(!(this.getParent()instanceof Element))return console.warn("Menu.options.parent NOT instanceof Element"),!1;var t,e,i,n;a.isA(this.align,h.Class)&&(this.node.style.position="absolute",this.node.style.width="fit-content",t=this.getParent(),i=e="right",(n=this.getParentMenu())&&n instanceof v&&(i=n.align.condition.horizontal.direction,e=n.align.condition.horizontal.align),this.align.offset=this.options.alignOffset,this.align.setNode(this.node).setParentNode(t).set(e,"top",i,"bottom"))},v.prototype.setPositionRecursive=function(){console.log("setPositionRecursive",this.id),b(this.id).forEach(function(t){t.menu.setPosition()})},v.prototype.getParentMenu=function(){var t=this.getParent();if(t instanceof Element&&t.hasOwnProperty("kit")&&t.kit[p]instanceof m)return t.kit[p].getMenu()},v.prototype.getParentMenuNode=function(){var t,e=this.getParentMenu();return t=e?e.node:t},v.prototype.addItem=function(t={}){var e;return t instanceof m?(t.parentId=this.id,e=t.options.id,this.itemList[e]=t):t instanceof Object&&(t.id||(t.id=a.uniqueId(8)),e=t.id,this.itemList[e]=new m(this.id).setOptions(t).init()),this.itemList[e]},v.prototype.addItemList=function(t=[]){var n=[];return t.forEach(function(t,e,i){n.push(this.addItem(t))}.bind(this)),n},v.prototype.sortItems=function(){this.itemList=Object.entries(this.itemList).sort(function(t,e){return Number(t[1].options.sort)-Number(e[1].options.sort)}).reduce((t,[e,i])=>({...t,[e]:i}),{})},v.prototype.render=function(){for(var t in this.sortItems(),this.node.innerHTML="",n.config.debug&&(this.node.innerHTML='
'+this.id+"
"),this.itemList)this.itemList.hasOwnProperty(t)&&this.node.append(this.itemList[t].getNode());return this},v.prototype.setParent=function(t){if(!((t=a.getNode(t))instanceof Element))return!1;this.options.parent=t,this.bInit&&this.init(!0)},v.prototype.setEventType=function(t="hint"){this.options.eventType=t,this.bInit&&this.init()},v.prototype.init=function(){var e=this,t=this.isActive();if(!(this.options.parent instanceof Element))return console.warn("Menu.init: Не установлен parent"),!1;this.viewer instanceof r&&this.viewer.stop(),this.render(),this.node.parentElement!==this.options.parent&&(this.node.remove(),this.options.parent.prepend(this.node)),this.align instanceof h.Class&&this.align.unset(),this.align=new h.Class(this.node,this.options.parent),this.actions instanceof s&&this.actions.stop();var i=new o[a.str.ucFirst(this.options.eventType)](this.options.parent,this.node);i.viewer instanceof r&&(this.viewer=i.viewer,i.viewer.onHideBefore.push(function(){var t=b(e.id);t.shift(),t.reverse().forEach(function(t){t.menu.viewer&&t.menu.viewer.hide({onHideBefore:!1})})}),i.viewer.onHide.push(function(){}),i.viewer.onShow.push(function(t={}){e.setPosition.call(e),t.recursiveMode||((t=b(e.id)).shift(),t.forEach(function(t){t.menu.viewer&&t.menu.viewer.show({recursiveMode:!0,force:!0})}))})),this.actions=new s([i]),this.actions.run(),this.isActive()||t?this.show({force:!0}):this.hide(),this.node.setAttribute("data-kit-menu-init",1),this.bInit=!0},v.prototype.setOptions=function(t={}){return this.options=Object.assign({},this.options,t),this.setParent(this.options.parent),this},m.prototype.defaultHoverHandler=function(t,e,i){console.log("hover: "+e.options.label)},m.prototype.defaultClickHandler=function(t,e,i){console.log("click: "+e.options.label),i.hide()},m.prototype.defaultDblClickHandler=function(t,e,i){console.log("dblclick: "+e.options.label)},m.prototype.getMenu=function(){return l[this.parentId]},m.prototype.getParent=function(){return l[this.parentId]instanceof v?l[this.parentId].node:null},m.prototype.getId=function(){return this.options.id},m.prototype.getNode=function(){return this.node},m.prototype.createNode=function(){this.node=document.createElement("a"),this.node.style.position="relative",this.node.dataset.parentId=this.parentId,a.setNodeData(this.node,"menuItem",this)},m.prototype.setLabel=function(t=""){this.options.label=t;var e=this.getNodeScopeElementByClassName("kit-menu-item__label");return this.setContent(e,t),this},m.prototype.setHref=function(t="javascript:void(0);"){return this.options.href=t,this.getNode().setAttribute("href",t),this},m.prototype.setIcon=function(t=""){this.options.icon=t;var e=this.getNodeScopeElementByClassName("kit-menu-item__icon");return this.setContent(e,t),this},m.prototype.setSort=function(t=500){return this.options.sort=Number(t),this},m.prototype.setArrow=function(t=""){this.options.arrow=t;var e=this.getNodeScopeElementByClassName("kit-menu-item__arrow");return this.setContent(e,t),this},m.prototype.setId=function(t=""){return t&&(this.options.id=t),this.node.id=this.options.id,this},m.prototype.setVisible=function(t=!0){return this.options.visible=t,this.node.style.display=this.options.visible?"":"none",this},m.prototype.setChild=function(t){var i;return t instanceof v?(t.setParent(this.node),t.init()):Array.isArray(t)&&(i=new v,t.forEach(function(t,e){"object"==typeof t&&i.addItem(t)}),i.setParent(this.node),i.init()),this},m.prototype.addClass=function(t=""){return t&&this.node.classList.add(t),this},m.prototype.setOptions=function(t={}){return this.options=Object.assign({},this.options,t),this},m.prototype.render=function(){return this.setLabel(this.options.label),this.setHref(this.options.href),this.setId(this.options.id),this.addClass("kit-menu-item"),this.addClass(this.options.class),this.setChild(this.options.child),this.setIcon(this.options.icon),this.setArrow(this.options.arrow),this.setVisible(this.options.visible),this.setSort(this.options.sort),this},m.prototype.init=function(){return this.bInit||(this.render(),this.node.removeEventListener("click",this,!1),this.node.removeEventListener("dblclick",this,!1),this.node.addEventListener("click",this,!1),this.node.addEventListener("dblclick",this,!1),this.bInit=!0),this},m.prototype.reInit=function(){return this.render(),this.node.removeEventListener("click",this,!1),this.node.removeEventListener("dblclick",this,!1),this.node.addEventListener("click",this,!1),this.node.addEventListener("dblclick",this,!1),this},m.prototype.remove=function(){this.node.removeEventListener("click",this,!1),this.node.removeEventListener("dblclick",this,!1);var t,e;this.options.id;setTimeout((t=this.parentId,e=this.options.id,function(){l.hasOwnProperty(t)&&l[t].itemList.hasOwnProperty(e)&&(delete l[t].itemList[e],l[t].init())}),0)},m.prototype.getNodeScopeElementByClassName=function(t=""){var e;return(e=this.node?this.node.querySelector(":scope > ."+t):e)||((e=document.createElement("div")).classList.add(t),this.node.append(e)),e},m.prototype.setContent=function(t,e){return a.innerHtml(t,e),!0};function y(){console.log("reCalcAllMenu"),g().forEach(function(t){t.menu.setPosition()})}var g=function(){var o=[],s=[],r=[];function h(t){var e,i=!1,n=l[t];return r.hasOwnProperty(t)&&r[t].parentMenu?r[t].parentMenu.id:(n&&(r[t]=r[t]||{},e=r[t].parentMenu=n.getParentMenu()),e?e.id:i)}l.forEach(function(t){var e,i,n;t instanceof v&&t.isActive()&&(i=t.id,r[i]=r[i]||{},r[i].menu=t,!(t=function(e){return function(){var t=r[e].data.parentId;return 1+(r.hasOwnProperty(t)?a.valueEx(r[t].data.depth):0)}})!==(n=h(i))&&(-1!==(e=o.indexOf(n))?-1===o.indexOf(i)&&(o.splice(e+1,0,i),s.splice(e+1,0,r[i].data={id:i,depth:t(i),parentId:n,type:1})):(r[n]=r[n]||{},-1!==(e=o.indexOf(i))?(o.splice(e,0,n),s.splice(e,0,r[n].data={id:n,depth:t(n),parentId:h(n),type:5})):(o.push(n),s.push(r[n].data={id:n,depth:t(n),parentId:h(n),type:2}),o.push(i),s.push(r[i].data={id:i,depth:t(i),parentId:n,type:3})))),-1===o.indexOf(i))&&(o.push(i),s.push(r[i].data={id:i,depth:1,parentId:0,type:4}))});var e=[];return s.forEach(function(t){t.depth=a.valueEx(t.depth),t.menu=r[t.id].menu,t.menu&&e.push(t)}),e},b=function(e){var t=g(),i=[],n=0;return t.forEach(function(t){(n=(n=t.id===e?t.depth:n)===t.depth&&t.id!==e||n>t.depth?0:n)&&i.push(t)}),i},w=new t.StackExecutionLimiter(this,y,100),t=function(){w.exec()},I=function(){w.exec()},t=(window.addEventListener("resize",t),window.addEventListener("scroll",I),{MenuItem:m,Class:v,getInstance:function(t={},e=[]){return t instanceof v?t:("string"==typeof t&&(t=document.querySelector(t)),a.getNodeData(t,c)||new v(t,e))},reInitAllMenu:function(){g().forEach(function(t){t.menu.init()})},reCalcAllMenu:y,autoload:function(t=document,e=".kit-menu"){if(!(t instanceof Node))return!1;t.querySelectorAll(e).forEach(function(t,e,i){t.kit&&t.kit.hasOwnProperty(c)})},getActiveMenuDataList:g,getChainActiveMenuDataList:b,MenuList:l});return i.exports=t}); \ No newline at end of file diff --git a/assets/support/support.js b/assets/support/support.js index 5c68dbf..4d3731d 100644 --- a/assets/support/support.js +++ b/assets/support/support.js @@ -260,6 +260,16 @@ __PluginManager__.register('support', function(require, exports, module, global) function isDomObject(o) { return isNode(o) || isElement(o) || isNodeList(o); } + function isEqualArrayValues(x, y, strict = false) { + var n = typeof x === 'number' && typeof y === 'number' && isNaN(x) && isNaN(y); + if(n){ + return true; + } + if(strict){ + return x === y; + } + return x == y; + } /** * @param selector * @return Element @@ -518,6 +528,7 @@ __PluginManager__.register('support', function(require, exports, module, global) isInteger, isFloat, isString, + isFunction, isNode, isNodeList, isDomObject, @@ -540,7 +551,8 @@ __PluginManager__.register('support', function(require, exports, module, global) getObjProp, whichAnimationEvent, whichTransitionEvent, - namespace + namespace, + isEqualArrayValues }; return module.exports = support; diff --git a/assets/support/support.min.js b/assets/support/support.min.js index 5d2675e..f393877 100644 --- a/assets/support/support.min.js +++ b/assets/support/support.min.js @@ -1 +1 @@ -__PluginManager__.register("support",function(n,t,e,r){window.pre=console.log;let o={set(n,t,e,r="kit"){n.setAttribute(`data${r=""!==r?"-"+r:r}-`+a(t),e)},remove(n,t,e="kit"){n.removeAttribute(`data${e=""!==e?"-"+e:e}-`+a(t))},getList(e,r="kit"){if(!(e=A(e)))return{};let i={};return Object.keys(e.dataset).filter(n=>n.startsWith(r)).forEach(n=>{var t=new RegExp("^"+r,""),t=n.replace(t,"");""!==(t=t.charAt(0).toLowerCase()+t.slice(1,t.length))&&(i[t]=u(e.dataset[n]))}),i},get(n,t,e="kit"){return u(n.getAttribute(`data${e=""!==e?"-"+e:e}-`+a(t)))}};function u(n){return"true"===n||"false"!==n&&(n===Number(n).toString()?Number(n):""===n||"null"===n?null:n)}function a(n){return n.replace(/[A-Z]/g,n=>"-"+n.toLowerCase())}function f(n){var t=[];if(1n.startsWith(r)).forEach(n=>{var t=new RegExp("^"+r,""),t=n.replace(t,"");""!==(t=t.charAt(0).toLowerCase()+t.slice(1,t.length))&&(i[t]=u(e.dataset[n]))}),i},get(n,t,e="kit"){return u(n.getAttribute(`data${e=""!==e?"-"+e:e}-`+a(t)))}};function u(n){return"true"===n||"false"!==n&&(n===Number(n).toString()?Number(n):""===n||"null"===n?null:n)}function a(n){return n.replace(/[A-Z]/g,n=>"-"+n.toLowerCase())}function f(n){var t=[];if(1