@cclr/front 0.1.30 → 0.1.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cjs/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e=require("@cclr/lang");function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function n(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,n){if(e){if("string"==typeof e)return t(e,n);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,n):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var r=function(){for(var t=[],o=0;o<arguments.length;o++){var i=o<0||arguments.length<=o?void 0:arguments[o];if(i)if("string"!=typeof i&&"number"!=typeof i){if(e.isArray(i)){var a=r.apply(void 0,n(i));a&&t.push(a)}else if("object"==typeof i){if(i.toString!==Object.prototype.toString){t.push(i.toString());continue}for(var u in i)e.hasOwn(i,u)&&i[u]&&t.push(u)}}else t.push(i)}return t.join(" ")},o="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",i=function(t,n,r,o){if(null==t||!t.addEventListener)throw new Error("The provided DOM element is not have addEventListener.");if("string"!=typeof n)throw new Error("The event type must be a string.");if(!(e.isFunction(r)||r instanceof Object))throw new Error("The listener must be a function or an EventListenerObject.");return t.addEventListener(n,r,o),function(){t.removeEventListener(n,r,o)}};exports.addEventListener=i,exports.addEventListenerMultiple=function(e,t,n){var r=[];return Object.keys(t).forEach(function(o){r.push(i(e,o,t[o],n))}),function(){r.forEach(function(e){return null==e?void 0:e()})}},exports.addStyleSheet=function(t){var n=document.createElement("style");if(n.setAttribute("type","text/css"),n.styleSheet)n.styleSheet.cssText=t;else{var r=document.createTextNode(t);n.appendChild(r)}var o=document.getElementsByTagName("head"),i=e.noop;return o.length?(o[0].appendChild(n),i=function(){o[0].removeChild(n)}):(document.documentElement.appendChild(n),i=function(){document.documentElement.removeChild(n)}),i},exports.classNames=r,exports.delDom=function(e){e&&(null!=e&&e.remove?e.remove():null!=e&&e.parentNode&&e.parentNode.removeChild(e))},exports.emptyImgBase64=o,exports.getEmptyImage=function(){var e=new Image;return e.src=o,e};
1
+ "use strict";var e=require("@cclr/lang"),t=require("@cclr/utils");function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function r(e){return function(e){if(Array.isArray(e))return n(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return n(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var o=function(){for(var t=[],n=0;n<arguments.length;n++){var i=n<0||arguments.length<=n?void 0:arguments[n];if(i)if("string"!=typeof i&&"number"!=typeof i){if(e.isArray(i)){var a=o.apply(void 0,r(i));a&&t.push(a)}else if("object"==typeof i){if(i.toString!==Object.prototype.toString){t.push(i.toString());continue}for(var u in i)e.hasOwn(i,u)&&i[u]&&t.push(u)}}else t.push(i)}return t.join(" ")},i="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",a=function(t,n,r,o){if(null==t||!t.addEventListener)throw new Error("The provided DOM element is not have addEventListener.");if("string"!=typeof n)throw new Error("The event type must be a string.");if(!(e.isFunction(r)||r instanceof Object))throw new Error("The listener must be a function or an EventListenerObject.");return t.addEventListener(n,r,o),function(){t.removeEventListener(n,r,o)}};exports.addEventListener=a,exports.addEventListenerMultiple=function(e,t,n){var r=[];return Object.keys(t).forEach(function(o){r.push(a(e,o,t[o],n))}),function(){r.forEach(function(e){return null==e?void 0:e()})}},exports.addStyleSheet=function(t){var n=document.createElement("style");if(n.setAttribute("type","text/css"),n.styleSheet)n.styleSheet.cssText=t;else{var r=document.createTextNode(t);n.appendChild(r)}var o=document.getElementsByTagName("head"),i=e.noop;return o.length?(o[0].appendChild(n),i=function(){o[0].removeChild(n)}):(document.documentElement.appendChild(n),i=function(){document.documentElement.removeChild(n)}),i},exports.classNames=o,exports.delDom=function(e){e&&(null!=e&&e.remove?e.remove():null!=e&&e.parentNode&&e.parentNode.removeChild(e))},exports.emptyImgBase64=i,exports.getEmptyImage=function(){var e=new Image;return e.src=i,e},exports.openNewWindow=function(e){var n=t.uuid(),r=document.createElement("a");r.setAttribute("href",e),r.setAttribute("target","_blank"),r.setAttribute("id",n),r.click(),setTimeout(function(){var e;null===(e=r.parentNode)||void 0===e||e.removeChild(r)},200)};
package/lib/esm/index.js CHANGED
@@ -1 +1 @@
1
- import{isArray as e,hasOwn as t,isFunction as n,noop as r}from"@cclr/lang";function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function i(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return o(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var a=function(){for(var n=[],r=0;r<arguments.length;r++){var o=r<0||arguments.length<=r?void 0:arguments[r];if(o)if("string"!=typeof o&&"number"!=typeof o){if(e(o)){var u=a.apply(void 0,i(o));u&&n.push(u)}else if("object"==typeof o){if(o.toString!==Object.prototype.toString){n.push(o.toString());continue}for(var l in o)t(o,l)&&o[l]&&n.push(l)}}else n.push(o)}return n.join(" ")},u="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",l=function(e){e&&(null!=e&&e.remove?e.remove():null!=e&&e.parentNode&&e.parentNode.removeChild(e))},c=function(){var e=new Image;return e.src=u,e},f=function(e,t,r,o){if(null==e||!e.addEventListener)throw new Error("The provided DOM element is not have addEventListener.");if("string"!=typeof t)throw new Error("The event type must be a string.");if(!(n(r)||r instanceof Object))throw new Error("The listener must be a function or an EventListenerObject.");return e.addEventListener(t,r,o),function(){e.removeEventListener(t,r,o)}},s=function(e,t,n){var r=[];return Object.keys(t).forEach(function(o){r.push(f(e,o,t[o],n))}),function(){r.forEach(function(e){return null==e?void 0:e()})}};function d(e){var t=document.createElement("style");if(t.setAttribute("type","text/css"),t.styleSheet)t.styleSheet.cssText=e;else{var n=document.createTextNode(e);t.appendChild(n)}var o=document.getElementsByTagName("head"),i=r;return o.length?(o[0].appendChild(t),i=function(){o[0].removeChild(t)}):(document.documentElement.appendChild(t),i=function(){document.documentElement.removeChild(t)}),i}export{f as addEventListener,s as addEventListenerMultiple,d as addStyleSheet,a as classNames,l as delDom,u as emptyImgBase64,c as getEmptyImage};
1
+ import{isArray as e,hasOwn as t,isFunction as n,noop as r}from"@cclr/lang";import{uuid as o}from"@cclr/utils";function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function a(e){return function(e){if(Array.isArray(e))return i(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var u=function(){for(var n=[],r=0;r<arguments.length;r++){var o=r<0||arguments.length<=r?void 0:arguments[r];if(o)if("string"!=typeof o&&"number"!=typeof o){if(e(o)){var i=u.apply(void 0,a(o));i&&n.push(i)}else if("object"==typeof o){if(o.toString!==Object.prototype.toString){n.push(o.toString());continue}for(var l in o)t(o,l)&&o[l]&&n.push(l)}}else n.push(o)}return n.join(" ")},l="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",c=function(e){e&&(null!=e&&e.remove?e.remove():null!=e&&e.parentNode&&e.parentNode.removeChild(e))},f=function(){var e=new Image;return e.src=l,e},s=function(e,t,r,o){if(null==e||!e.addEventListener)throw new Error("The provided DOM element is not have addEventListener.");if("string"!=typeof t)throw new Error("The event type must be a string.");if(!(n(r)||r instanceof Object))throw new Error("The listener must be a function or an EventListenerObject.");return e.addEventListener(t,r,o),function(){e.removeEventListener(t,r,o)}},d=function(e,t,n){var r=[];return Object.keys(t).forEach(function(o){r.push(s(e,o,t[o],n))}),function(){r.forEach(function(e){return null==e?void 0:e()})}};function m(e){var t=document.createElement("style");if(t.setAttribute("type","text/css"),t.styleSheet)t.styleSheet.cssText=e;else{var n=document.createTextNode(e);t.appendChild(n)}var o=document.getElementsByTagName("head"),i=r;return o.length?(o[0].appendChild(t),i=function(){o[0].removeChild(t)}):(document.documentElement.appendChild(t),i=function(){document.documentElement.removeChild(t)}),i}var A=function(e){var t=o(),n=document.createElement("a");n.setAttribute("href",e),n.setAttribute("target","_blank"),n.setAttribute("id",t),n.click(),setTimeout(function(){var e;null===(e=n.parentNode)||void 0===e||e.removeChild(n)},200)};export{s as addEventListener,d as addEventListenerMultiple,m as addStyleSheet,u as classNames,c as delDom,l as emptyImgBase64,f as getEmptyImage,A as openNewWindow};
@@ -226,5 +226,13 @@ declare const addEventListenerMultiple: <T extends HTMLElement = HTMLElement>(do
226
226
  */
227
227
  declare function addStyleSheet(cssStr: string): () => void;
228
228
 
229
- export { addEventListener, addEventListenerMultiple, addStyleSheet, classNames, delDom, emptyImgBase64, getEmptyImage };
229
+ /**
230
+ * Web浏览器打开新窗口,替代window.open
231
+ * ```
232
+ * 直接使用window.open会被浏览器拦截
233
+ * ```
234
+ */
235
+ declare const openNewWindow: (url: string) => void;
236
+
237
+ export { addEventListener, addEventListenerMultiple, addStyleSheet, classNames, delDom, emptyImgBase64, getEmptyImage, openNewWindow };
230
238
  export type { CommonDOMEventTypes, EventListenerOptions, TEventMap };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cclr/front",
3
- "version": "0.1.30",
3
+ "version": "0.1.44",
4
4
  "description": "前端开发使用工具",
5
5
  "author": "cclr <18843152354@163.com>",
6
6
  "homepage": "",
@@ -27,9 +27,9 @@
27
27
  "g:test": "vitest run",
28
28
  "g:build": "drr build"
29
29
  },
30
- "gitHead": "d5460c73e4a84dfb5c6239ebc8cc05574d70b18b",
30
+ "gitHead": "afd2fc69e186fe3cb4aeaa07b5909d45f7260619",
31
31
  "dependencies": {
32
- "@cclr/lang": "0.1.30",
33
- "@cclr/utils": "0.1.30"
32
+ "@cclr/lang": "^0.1.44",
33
+ "@cclr/utils": "^0.1.44"
34
34
  }
35
35
  }