mirror of
https://bitbucket.org/bellord13/kit.git
synced 2026-11-13 19:06:11 +03:00
fix
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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});
|
||||
@@ -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++;
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -259,7 +259,7 @@ __PluginManager__.register('bsToast', function(require, exports, module){
|
||||
|
||||
|
||||
/**
|
||||
* @memberOf kit
|
||||
* @memberOf {kit}
|
||||
* @class bsToast
|
||||
**/
|
||||
var bsToast = Toast;
|
||||
|
||||
Vendored
+1
@@ -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});
|
||||
+64
-25
@@ -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'){
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -56,7 +56,6 @@ __PluginManager__.register('menu',function(require, exports, module, global) {
|
||||
|
||||
|
||||
/**
|
||||
* @class kit.menu.Class
|
||||
* @param options
|
||||
* @param items
|
||||
*/
|
||||
|
||||
Vendored
+1
File diff suppressed because one or more lines are too long
@@ -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;
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user