@i.un/libs
Advanced tools
Comparing version 0.0.15 to 0.0.16
@@ -1,2 +0,2 @@ | ||
function t(t){return"function"==typeof(null==t?void 0:t.clone)}function e(t){const e=typeof t;return null===t||"string"===e||"number"===e||"boolean"===e||"undefined"===e}function n(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:this}function r(t){return e(t)?String(t):JSON.stringify(t,function(t,e){return"object"!=typeof e||null===e||Array.isArray(e)?e:Object.keys(e).sort().reduce((t,n)=>(t[n]=e[n],t),{})})}function o(e){if(null===e||"object"!=typeof e)return e;if(t(e))return e.clone();if(Array.isArray(e))return e.map(t=>o(t));const n={};for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=o(e[t]));return n}function i(t,e){let n=null;return function(...r){const o=this;null!==n&&clearTimeout(n),n=setTimeout(()=>{t.apply(o,r),n=null},e)}}function s(t,e){let n=0;return function(...r){const o=Date.now();o-n>=e&&(t.apply(this,r),n=o)}}function c(t,e=0){return new Promise(n=>{0===e?n(t()):setTimeout(()=>{n(t())},e)})}const u={};function l(t){return u[t]}const f={timeout:6e4,timeoutResult:{code:408,msg:"请求超时"},identifier:""};function a(t,e=f){return function(...n){const i=r(n)+t.name+(e.identifier||"");if(u[i])return Promise.resolve(o(l(i)));const s=i+"_l_o_a_d_i_n_g_";if(u[s]){const t=Object.assign({},f,e);return new Promise(e=>{const n=Date.now(),r=setInterval(()=>{u[i]?(clearInterval(r),e(o(l(i)))):Date.now()-n>t.timeout&&(u[s]=!1,clearInterval(r),e(o(t.timeoutResult)))},100)})}return u[s]=!0,t(...n).then(t=>(u[i]=t,o(u[i]))).catch(t=>{throw t}).finally(()=>{u[s]=!1})}}function d(t){const e=function e(...n){if(e.isExecuting)return void console.log(`Function(${t.name}) is executing.`);let r;e.isExecuting=!0;try{r=t(...n),r instanceof Promise?r.finally(()=>{e.isExecuting=!1}):e.isExecuting=!1}catch(t){throw e.isExecuting=!1,t}return r};return e.isExecuting=!1,e}function g(t,e,n,r=!1){if(e in t.style)t.style[e]=n;else{const o=r?"important":"";t.style.setProperty(e,String(n),o)}}function p({tag:t="div",children:e=[],props:n={},attrs:r={},styles:o={}}={}){const i=document.createElement(t);Object.assign(i,n);for(const[t,e]of Object.entries(r))!1!==e&&i.setAttribute(t,e);for(const[t,e]of Object.entries(o))g(i,t,e);const s=Array.isArray(e)?e:[e];for(const t of s)t&&("object"==typeof t?t instanceof Element?i.appendChild(t):i.appendChild(p(t)):i.appendChild(document.createTextNode(t)));return i}function y(t,e){const{width:n=32,height:r=32}=e||{},o=document.createElementNS("http://www.w3.org/2000/svg","svg");return o.setAttribute("width",n.toString()),o.setAttribute("height",r.toString()),o.setAttribute("viewBox",`0 0 ${n} ${r}`),"string"==typeof t?o.innerHTML=t:(Array.isArray(t)?t:[t]).forEach(t=>{o.appendChild(h(t))}),o}function h(t){const{tag:e,attributes:n,children:r}=t,o=document.createElementNS("http://www.w3.org/2000/svg",e);if(n)for(const[t,e]of Object.entries(n))o.setAttribute(t,e);return"string"==typeof r?o.textContent=r:r&&(Array.isArray(r)?r:[r]).forEach(t=>{o.appendChild(h(t))}),o}function m(t){t&&setTimeout(()=>{t.scrollTop=t.scrollHeight},0)}function w(t){t&&("true"!==t.dataset.isListeningForUserScroll&&(function(t){t&&t.addEventListener("scroll",()=>{!function(t,e){t.dataset.userInteracted=e?"true":"false"}(t,t.scrollTop+t.clientHeight<t.scrollHeight-5)})}(t),t.dataset.isListeningForUserScroll="true"),"true"!==t.dataset.userInteracted&&m(t))}export{a as cacheWrapper,o as cloneDeep,p as createElement,y as createSvg,i as debounce,c as delayExecution,r as generateStableUniqueKey,n as getGlobal,t as isCloneable,e as isPrimitive,m as scrollToBottom,w as scrollToBottomIfNeeded,d as singleExecutionWrapper,s as throttle}; | ||
function t(t){return"function"==typeof(null==t?void 0:t.clone)}function e(t){const e=typeof t;return null===t||"string"===e||"number"===e||"boolean"===e||"undefined"===e}function n(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:this}function r(t){return e(t)?String(t):JSON.stringify(t,function(t,e){return"object"!=typeof e||null===e||Array.isArray(e)?e:Object.keys(e).sort().reduce((t,n)=>(t[n]=e[n],t),{})})}function i(e){if(null===e||"object"!=typeof e)return e;if(t(e))return e.clone();if(Array.isArray(e))return e.map(t=>i(t));const n={};for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=i(e[t]));return n}function o(t,e){let n=null;return function(...r){const i=this;null!==n&&clearTimeout(n),n=setTimeout(()=>{t.apply(i,r),n=null},e)}}function s(t,e){let n=0;return function(...r){const i=Date.now();i-n>=e&&(t.apply(this,r),n=i)}}function c(t,e=0){return new Promise(n=>{0===e?n(t()):setTimeout(()=>{n(t())},e)})}const u={};function l(t){return u[t]}const f={timeout:6e4,timeoutResult:{code:408,msg:"请求超时"},identifier:""};function a(t,e=f){return function(...n){const o=r(n)+t.name+(e.identifier||"");if(u[o])return Promise.resolve(i(l(o)));const s=o+"_l_o_a_d_i_n_g_";if(u[s]){const t=Object.assign({},f,e);return new Promise(e=>{const n=Date.now(),r=setInterval(()=>{u[o]?(clearInterval(r),e(i(l(o)))):Date.now()-n>t.timeout&&(u[s]=!1,clearInterval(r),e(i(t.timeoutResult)))},100)})}return u[s]=!0,t(...n).then(t=>(u[o]=t,i(u[o]))).catch(t=>{throw t}).finally(()=>{u[s]=!1})}}function d(t){const e=function e(...n){if(e.isExecuting)return void console.log(`Function(${t.name}) is executing.`);let r;e.isExecuting=!0;try{r=t(...n),r instanceof Promise?r.finally(()=>{e.isExecuting=!1}):e.isExecuting=!1}catch(t){throw e.isExecuting=!1,t}return r};return e.isExecuting=!1,e}function g(t,e,n,r=!1){if(e in t.style)t.style[e]=n;else{const i=r?"important":"";t.style.setProperty(e,String(n),i)}}function p({tag:t="div",children:e=[],props:n={},attrs:r={},styles:i={}}={}){const o=document.createElement(t);Object.assign(o,n);for(const[t,e]of Object.entries(r))!1!==e&&o.setAttribute(t,e);for(const[t,e]of Object.entries(i))g(o,t,e);const s=Array.isArray(e)?e:[e];for(const t of s)t&&("object"==typeof t?t instanceof Element?o.appendChild(t):o.appendChild(p(t)):o.appendChild(document.createTextNode(t)));return o}function h(t,e){const{width:n=32,height:r=32}=e||{},i=document.createElementNS("http://www.w3.org/2000/svg","svg");if(i.setAttribute("width",n.toString()),i.setAttribute("height",r.toString()),i.setAttribute("viewBox",`0 0 ${n} ${r}`),"string"==typeof t){const e=(new DOMParser).parseFromString(`<svg xmlns="http://www.w3.org/2000/svg">${t}</svg>`,"image/svg+xml").documentElement;for(;e.firstChild;)i.appendChild(e.firstChild)}else(Array.isArray(t)?t:[t]).forEach(t=>{i.appendChild(y(t))});return i}function y(t){const{tag:e,attributes:n,children:r}=t,i=document.createElementNS("http://www.w3.org/2000/svg",e);if(n)for(const[t,e]of Object.entries(n))i.setAttribute(t,e);return"string"==typeof r?i.textContent=r:r&&(Array.isArray(r)?r:[r]).forEach(t=>{i.appendChild(y(t))}),i}function m(t){t&&setTimeout(()=>{t.scrollTop=t.scrollHeight},0)}function w(t){t&&("true"!==t.dataset.isListeningForUserScroll&&(function(t){t&&t.addEventListener("scroll",()=>{!function(t,e){t.dataset.userInteracted=e?"true":"false"}(t,t.scrollTop+t.clientHeight<t.scrollHeight-5)})}(t),t.dataset.isListeningForUserScroll="true"),"true"!==t.dataset.userInteracted&&m(t))}export{a as cacheWrapper,i as cloneDeep,p as createElement,h as createSvg,o as debounce,c as delayExecution,r as generateStableUniqueKey,n as getGlobal,t as isCloneable,e as isPrimitive,m as scrollToBottom,w as scrollToBottomIfNeeded,d as singleExecutionWrapper,s as throttle}; | ||
//# sourceMappingURL=index.modern.js.map |
@@ -1,2 +0,2 @@ | ||
function t(t){return"function"==typeof(null==t?void 0:t.clone)}function e(t){var e=typeof t;return null===t||"string"===e||"number"===e||"boolean"===e||"undefined"===e}function n(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:this}function r(t){return e(t)?String(t):JSON.stringify(t,function(t,e){return"object"!=typeof e||null===e||Array.isArray(e)?e:Object.keys(e).sort().reduce(function(t,n){return t[n]=e[n],t},{})})}function i(e){if(null===e||"object"!=typeof e)return e;if(t(e))return e.clone();if(Array.isArray(e))return e.map(function(t){return i(t)});var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=i(e[r]));return n}function o(t,e){var n=null;return function(){var r=arguments,i=this;null!==n&&clearTimeout(n),n=setTimeout(function(){t.apply(i,[].slice.call(r)),n=null},e)}}function u(t,e){var n=0;return function(){var r=Date.now();r-n>=e&&(t.apply(this,[].slice.call(arguments)),n=r)}}function a(t,e){return void 0===e&&(e=0),new Promise(function(n){0===e?n(t()):setTimeout(function(){n(t())},e)})}var c={};function l(t){return c[t]}var s={timeout:6e4,timeoutResult:{code:408,msg:"请求超时"},identifier:""};function f(t,e){return void 0===e&&(e=s),function(){var n=[].slice.call(arguments),o=r(n)+t.name+(e.identifier||"");if(c[o])return Promise.resolve(i(l(o)));var u=o+"_l_o_a_d_i_n_g_";if(c[u]){var a=Object.assign({},s,e);return new Promise(function(t){var e=Date.now(),n=setInterval(function(){c[o]?(clearInterval(n),t(i(l(o)))):Date.now()-e>a.timeout&&(c[u]=!1,clearInterval(n),t(i(a.timeoutResult)))},100)})}return c[u]=!0,t.apply(void 0,n).then(function(t){return c[o]=t,i(c[o])}).catch(function(t){throw t}).finally(function(){c[u]=!1})}}function d(t){var e=function(){if(!e.isExecuting){var n;e.isExecuting=!0;try{(n=t.apply(void 0,[].slice.call(arguments)))instanceof Promise?n.finally(function(){e.isExecuting=!1}):e.isExecuting=!1}catch(t){throw e.isExecuting=!1,t}return n}console.log("Function("+t.name+") is executing.")};return e.isExecuting=!1,e}function v(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function y(t,e,n,r){if(void 0===r&&(r=!1),e in t.style)t.style[e]=n;else{var i=r?"important":"";t.style.setProperty(e,String(n),i)}}function p(t){var e=void 0===t?{}:t,n=e.tag,r=e.children,i=void 0===r?[]:r,o=e.props,u=void 0===o?{}:o,a=e.attrs,c=void 0===a?{}:a,l=e.styles,s=void 0===l?{}:l,f=document.createElement(void 0===n?"div":n);Object.assign(f,u);for(var d=0,g=Object.entries(c);d<g.length;d++){var h=g[d],m=h[1];!1!==m&&f.setAttribute(h[0],m)}for(var b=0,w=Object.entries(s);b<w.length;b++){var A=w[b];y(f,A[0],A[1])}for(var E,S=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(e)return(e=e.call(t)).next.bind(e);if(Array.isArray(t)||(e=function(t,e){if(t){if("string"==typeof t)return v(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(t,e):void 0}}(t))){e&&(t=e);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(Array.isArray(i)?i:[i]);!(E=S()).done;){var j=E.value;j&&("object"==typeof j?j instanceof Element?f.appendChild(j):f.appendChild(p(j)):f.appendChild(document.createTextNode(j)))}return f}function g(t,e){var n=e||{},r=n.width,i=void 0===r?32:r,o=n.height,u=void 0===o?32:o,a=document.createElementNS("http://www.w3.org/2000/svg","svg");return a.setAttribute("width",i.toString()),a.setAttribute("height",u.toString()),a.setAttribute("viewBox","0 0 "+i+" "+u),"string"==typeof t?a.innerHTML=t:(Array.isArray(t)?t:[t]).forEach(function(t){a.appendChild(h(t))}),a}function h(t){var e=t.attributes,n=t.children,r=document.createElementNS("http://www.w3.org/2000/svg",t.tag);if(e)for(var i=0,o=Object.entries(e);i<o.length;i++){var u=o[i];r.setAttribute(u[0],u[1])}return"string"==typeof n?r.textContent=n:n&&(Array.isArray(n)?n:[n]).forEach(function(t){r.appendChild(h(t))}),r}function m(t){t&&setTimeout(function(){t.scrollTop=t.scrollHeight},0)}function b(t){t&&("true"!==t.dataset.isListeningForUserScroll&&(function(t){t&&t.addEventListener("scroll",function(){!function(t,e){t.dataset.userInteracted=e?"true":"false"}(t,t.scrollTop+t.clientHeight<t.scrollHeight-5)})}(t),t.dataset.isListeningForUserScroll="true"),"true"!==t.dataset.userInteracted&&m(t))}export{f as cacheWrapper,i as cloneDeep,p as createElement,g as createSvg,o as debounce,a as delayExecution,r as generateStableUniqueKey,n as getGlobal,t as isCloneable,e as isPrimitive,m as scrollToBottom,b as scrollToBottomIfNeeded,d as singleExecutionWrapper,u as throttle}; | ||
function t(t){return"function"==typeof(null==t?void 0:t.clone)}function e(t){var e=typeof t;return null===t||"string"===e||"number"===e||"boolean"===e||"undefined"===e}function n(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:this}function r(t){return e(t)?String(t):JSON.stringify(t,function(t,e){return"object"!=typeof e||null===e||Array.isArray(e)?e:Object.keys(e).sort().reduce(function(t,n){return t[n]=e[n],t},{})})}function i(e){if(null===e||"object"!=typeof e)return e;if(t(e))return e.clone();if(Array.isArray(e))return e.map(function(t){return i(t)});var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=i(e[r]));return n}function o(t,e){var n=null;return function(){var r=arguments,i=this;null!==n&&clearTimeout(n),n=setTimeout(function(){t.apply(i,[].slice.call(r)),n=null},e)}}function a(t,e){var n=0;return function(){var r=Date.now();r-n>=e&&(t.apply(this,[].slice.call(arguments)),n=r)}}function u(t,e){return void 0===e&&(e=0),new Promise(function(n){0===e?n(t()):setTimeout(function(){n(t())},e)})}var l={};function c(t){return l[t]}var s={timeout:6e4,timeoutResult:{code:408,msg:"请求超时"},identifier:""};function f(t,e){return void 0===e&&(e=s),function(){var n=[].slice.call(arguments),o=r(n)+t.name+(e.identifier||"");if(l[o])return Promise.resolve(i(c(o)));var a=o+"_l_o_a_d_i_n_g_";if(l[a]){var u=Object.assign({},s,e);return new Promise(function(t){var e=Date.now(),n=setInterval(function(){l[o]?(clearInterval(n),t(i(c(o)))):Date.now()-e>u.timeout&&(l[a]=!1,clearInterval(n),t(i(u.timeoutResult)))},100)})}return l[a]=!0,t.apply(void 0,n).then(function(t){return l[o]=t,i(l[o])}).catch(function(t){throw t}).finally(function(){l[a]=!1})}}function d(t){var e=function(){if(!e.isExecuting){var n;e.isExecuting=!0;try{(n=t.apply(void 0,[].slice.call(arguments)))instanceof Promise?n.finally(function(){e.isExecuting=!1}):e.isExecuting=!1}catch(t){throw e.isExecuting=!1,t}return n}console.log("Function("+t.name+") is executing.")};return e.isExecuting=!1,e}function v(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function g(t,e,n,r){if(void 0===r&&(r=!1),e in t.style)t.style[e]=n;else{var i=r?"important":"";t.style.setProperty(e,String(n),i)}}function p(t){var e=void 0===t?{}:t,n=e.tag,r=e.children,i=void 0===r?[]:r,o=e.props,a=void 0===o?{}:o,u=e.attrs,l=void 0===u?{}:u,c=e.styles,s=void 0===c?{}:c,f=document.createElement(void 0===n?"div":n);Object.assign(f,a);for(var d=0,y=Object.entries(l);d<y.length;d++){var h=y[d],m=h[1];!1!==m&&f.setAttribute(h[0],m)}for(var b=0,w=Object.entries(s);b<w.length;b++){var A=w[b];g(f,A[0],A[1])}for(var E,S=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(e)return(e=e.call(t)).next.bind(e);if(Array.isArray(t)||(e=function(t,e){if(t){if("string"==typeof t)return v(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(t,e):void 0}}(t))){e&&(t=e);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(Array.isArray(i)?i:[i]);!(E=S()).done;){var x=E.value;x&&("object"==typeof x?x instanceof Element?f.appendChild(x):f.appendChild(p(x)):f.appendChild(document.createTextNode(x)))}return f}function y(t,e){var n=e||{},r=n.width,i=void 0===r?32:r,o=n.height,a=void 0===o?32:o,u=document.createElementNS("http://www.w3.org/2000/svg","svg");if(u.setAttribute("width",i.toString()),u.setAttribute("height",a.toString()),u.setAttribute("viewBox","0 0 "+i+" "+a),"string"==typeof t)for(var l=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg">'+t+"</svg>","image/svg+xml").documentElement;l.firstChild;)u.appendChild(l.firstChild);else(Array.isArray(t)?t:[t]).forEach(function(t){u.appendChild(h(t))});return u}function h(t){var e=t.attributes,n=t.children,r=document.createElementNS("http://www.w3.org/2000/svg",t.tag);if(e)for(var i=0,o=Object.entries(e);i<o.length;i++){var a=o[i];r.setAttribute(a[0],a[1])}return"string"==typeof n?r.textContent=n:n&&(Array.isArray(n)?n:[n]).forEach(function(t){r.appendChild(h(t))}),r}function m(t){t&&setTimeout(function(){t.scrollTop=t.scrollHeight},0)}function b(t){t&&("true"!==t.dataset.isListeningForUserScroll&&(function(t){t&&t.addEventListener("scroll",function(){!function(t,e){t.dataset.userInteracted=e?"true":"false"}(t,t.scrollTop+t.clientHeight<t.scrollHeight-5)})}(t),t.dataset.isListeningForUserScroll="true"),"true"!==t.dataset.userInteracted&&m(t))}export{f as cacheWrapper,i as cloneDeep,p as createElement,y as createSvg,o as debounce,u as delayExecution,r as generateStableUniqueKey,n as getGlobal,t as isCloneable,e as isPrimitive,m as scrollToBottom,b as scrollToBottomIfNeeded,d as singleExecutionWrapper,a as throttle}; | ||
//# sourceMappingURL=index.module.js.map |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t||self).iunLibs={})}(this,function(t){function e(t){return"function"==typeof(null==t?void 0:t.clone)}function n(t){var e=typeof t;return null===t||"string"===e||"number"===e||"boolean"===e||"undefined"===e}function r(t){return n(t)?String(t):JSON.stringify(t,function(t,e){return"object"!=typeof e||null===e||Array.isArray(e)?e:Object.keys(e).sort().reduce(function(t,n){return t[n]=e[n],t},{})})}function i(t){if(null===t||"object"!=typeof t)return t;if(e(t))return t.clone();if(Array.isArray(t))return t.map(function(t){return i(t)});var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=i(t[r]));return n}var o={};function a(t){return o[t]}var u={timeout:6e4,timeoutResult:{code:408,msg:"请求超时"},identifier:""};function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function c(t,e,n,r){if(void 0===r&&(r=!1),e in t.style)t.style[e]=n;else{var i=r?"important":"";t.style.setProperty(e,String(n),i)}}function s(t){var e=t.attributes,n=t.children,r=document.createElementNS("http://www.w3.org/2000/svg",t.tag);if(e)for(var i=0,o=Object.entries(e);i<o.length;i++){var a=o[i];r.setAttribute(a[0],a[1])}return"string"==typeof n?r.textContent=n:n&&(Array.isArray(n)?n:[n]).forEach(function(t){r.appendChild(s(t))}),r}function f(t){t&&setTimeout(function(){t.scrollTop=t.scrollHeight},0)}t.cacheWrapper=function(t,e){return void 0===e&&(e=u),function(){var n=[].slice.call(arguments),l=r(n)+t.name+(e.identifier||"");if(o[l])return Promise.resolve(i(a(l)));var c=l+"_l_o_a_d_i_n_g_";if(o[c]){var s=Object.assign({},u,e);return new Promise(function(t){var e=Date.now(),n=setInterval(function(){o[l]?(clearInterval(n),t(i(a(l)))):Date.now()-e>s.timeout&&(o[c]=!1,clearInterval(n),t(i(s.timeoutResult)))},100)})}return o[c]=!0,t.apply(void 0,n).then(function(t){return o[l]=t,i(o[l])}).catch(function(t){throw t}).finally(function(){o[c]=!1})}},t.cloneDeep=i,t.createElement=function t(e){var n=void 0===e?{}:e,r=n.tag,i=n.children,o=void 0===i?[]:i,a=n.props,u=void 0===a?{}:a,s=n.attrs,f=void 0===s?{}:s,d=n.styles,v=void 0===d?{}:d,p=document.createElement(void 0===r?"div":r);Object.assign(p,u);for(var y=0,g=Object.entries(f);y<g.length;y++){var h=g[y],m=h[1];!1!==m&&p.setAttribute(h[0],m)}for(var b=0,w=Object.entries(v);b<w.length;b++){var A=w[b];c(p,A[0],A[1])}for(var E,x=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(e)return(e=e.call(t)).next.bind(e);if(Array.isArray(t)||(e=function(t,e){if(t){if("string"==typeof t)return l(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(t,e):void 0}}(t))){e&&(t=e);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(Array.isArray(o)?o:[o]);!(E=x()).done;){var S=E.value;S&&("object"==typeof S?S instanceof Element?p.appendChild(S):p.appendChild(t(S)):p.appendChild(document.createTextNode(S)))}return p},t.createSvg=function(t,e){var n=e||{},r=n.width,i=void 0===r?32:r,o=n.height,a=void 0===o?32:o,u=document.createElementNS("http://www.w3.org/2000/svg","svg");return u.setAttribute("width",i.toString()),u.setAttribute("height",a.toString()),u.setAttribute("viewBox","0 0 "+i+" "+a),"string"==typeof t?u.innerHTML=t:(Array.isArray(t)?t:[t]).forEach(function(t){u.appendChild(s(t))}),u},t.debounce=function(t,e){var n=null;return function(){var r=arguments,i=this;null!==n&&clearTimeout(n),n=setTimeout(function(){t.apply(i,[].slice.call(r)),n=null},e)}},t.delayExecution=function(t,e){return void 0===e&&(e=0),new Promise(function(n){0===e?n(t()):setTimeout(function(){n(t())},e)})},t.generateStableUniqueKey=r,t.getGlobal=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:this},t.isCloneable=e,t.isPrimitive=n,t.scrollToBottom=f,t.scrollToBottomIfNeeded=function(t){t&&("true"!==t.dataset.isListeningForUserScroll&&(function(t){t&&t.addEventListener("scroll",function(){!function(t,e){t.dataset.userInteracted=e?"true":"false"}(t,t.scrollTop+t.clientHeight<t.scrollHeight-5)})}(t),t.dataset.isListeningForUserScroll="true"),"true"!==t.dataset.userInteracted&&f(t))},t.singleExecutionWrapper=function(t){var e=function(){if(!e.isExecuting){var n;e.isExecuting=!0;try{(n=t.apply(void 0,[].slice.call(arguments)))instanceof Promise?n.finally(function(){e.isExecuting=!1}):e.isExecuting=!1}catch(t){throw e.isExecuting=!1,t}return n}console.log("Function("+t.name+") is executing.")};return e.isExecuting=!1,e},t.throttle=function(t,e){var n=0;return function(){var r=Date.now();r-n>=e&&(t.apply(this,[].slice.call(arguments)),n=r)}}}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t||self).iunLibs={})}(this,function(t){function e(t){return"function"==typeof(null==t?void 0:t.clone)}function n(t){var e=typeof t;return null===t||"string"===e||"number"===e||"boolean"===e||"undefined"===e}function r(t){return n(t)?String(t):JSON.stringify(t,function(t,e){return"object"!=typeof e||null===e||Array.isArray(e)?e:Object.keys(e).sort().reduce(function(t,n){return t[n]=e[n],t},{})})}function i(t){if(null===t||"object"!=typeof t)return t;if(e(t))return t.clone();if(Array.isArray(t))return t.map(function(t){return i(t)});var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=i(t[r]));return n}var o={};function a(t){return o[t]}var u={timeout:6e4,timeoutResult:{code:408,msg:"请求超时"},identifier:""};function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function c(t,e,n,r){if(void 0===r&&(r=!1),e in t.style)t.style[e]=n;else{var i=r?"important":"";t.style.setProperty(e,String(n),i)}}function s(t){var e=t.attributes,n=t.children,r=document.createElementNS("http://www.w3.org/2000/svg",t.tag);if(e)for(var i=0,o=Object.entries(e);i<o.length;i++){var a=o[i];r.setAttribute(a[0],a[1])}return"string"==typeof n?r.textContent=n:n&&(Array.isArray(n)?n:[n]).forEach(function(t){r.appendChild(s(t))}),r}function f(t){t&&setTimeout(function(){t.scrollTop=t.scrollHeight},0)}t.cacheWrapper=function(t,e){return void 0===e&&(e=u),function(){var n=[].slice.call(arguments),l=r(n)+t.name+(e.identifier||"");if(o[l])return Promise.resolve(i(a(l)));var c=l+"_l_o_a_d_i_n_g_";if(o[c]){var s=Object.assign({},u,e);return new Promise(function(t){var e=Date.now(),n=setInterval(function(){o[l]?(clearInterval(n),t(i(a(l)))):Date.now()-e>s.timeout&&(o[c]=!1,clearInterval(n),t(i(s.timeoutResult)))},100)})}return o[c]=!0,t.apply(void 0,n).then(function(t){return o[l]=t,i(o[l])}).catch(function(t){throw t}).finally(function(){o[c]=!1})}},t.cloneDeep=i,t.createElement=function t(e){var n=void 0===e?{}:e,r=n.tag,i=n.children,o=void 0===i?[]:i,a=n.props,u=void 0===a?{}:a,s=n.attrs,f=void 0===s?{}:s,d=n.styles,v=void 0===d?{}:d,p=document.createElement(void 0===r?"div":r);Object.assign(p,u);for(var g=0,y=Object.entries(f);g<y.length;g++){var h=y[g],m=h[1];!1!==m&&p.setAttribute(h[0],m)}for(var b=0,w=Object.entries(v);b<w.length;b++){var A=w[b];c(p,A[0],A[1])}for(var x,E=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(e)return(e=e.call(t)).next.bind(e);if(Array.isArray(t)||(e=function(t,e){if(t){if("string"==typeof t)return l(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(t,e):void 0}}(t))){e&&(t=e);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(Array.isArray(o)?o:[o]);!(x=E()).done;){var S=x.value;S&&("object"==typeof S?S instanceof Element?p.appendChild(S):p.appendChild(t(S)):p.appendChild(document.createTextNode(S)))}return p},t.createSvg=function(t,e){var n=e||{},r=n.width,i=void 0===r?32:r,o=n.height,a=void 0===o?32:o,u=document.createElementNS("http://www.w3.org/2000/svg","svg");if(u.setAttribute("width",i.toString()),u.setAttribute("height",a.toString()),u.setAttribute("viewBox","0 0 "+i+" "+a),"string"==typeof t)for(var l=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg">'+t+"</svg>","image/svg+xml").documentElement;l.firstChild;)u.appendChild(l.firstChild);else(Array.isArray(t)?t:[t]).forEach(function(t){u.appendChild(s(t))});return u},t.debounce=function(t,e){var n=null;return function(){var r=arguments,i=this;null!==n&&clearTimeout(n),n=setTimeout(function(){t.apply(i,[].slice.call(r)),n=null},e)}},t.delayExecution=function(t,e){return void 0===e&&(e=0),new Promise(function(n){0===e?n(t()):setTimeout(function(){n(t())},e)})},t.generateStableUniqueKey=r,t.getGlobal=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:this},t.isCloneable=e,t.isPrimitive=n,t.scrollToBottom=f,t.scrollToBottomIfNeeded=function(t){t&&("true"!==t.dataset.isListeningForUserScroll&&(function(t){t&&t.addEventListener("scroll",function(){!function(t,e){t.dataset.userInteracted=e?"true":"false"}(t,t.scrollTop+t.clientHeight<t.scrollHeight-5)})}(t),t.dataset.isListeningForUserScroll="true"),"true"!==t.dataset.userInteracted&&f(t))},t.singleExecutionWrapper=function(t){var e=function(){if(!e.isExecuting){var n;e.isExecuting=!0;try{(n=t.apply(void 0,[].slice.call(arguments)))instanceof Promise?n.finally(function(){e.isExecuting=!1}):e.isExecuting=!1}catch(t){throw e.isExecuting=!1,t}return n}console.log("Function("+t.name+") is executing.")};return e.isExecuting=!1,e},t.throttle=function(t,e){var n=0;return function(){var r=Date.now();r-n>=e&&(t.apply(this,[].slice.call(arguments)),n=r)}}}); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "@i.un/libs", | ||
"version": "0.0.15", | ||
"version": "0.0.16", | ||
"description": "一个实用的ts函数库", | ||
@@ -5,0 +5,0 @@ "type": "module", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
132868
331