@cclr/front 0.1.15 → 0.1.17
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 +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/type/index.d.ts +8 -1
- package/package.json +4 -4
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
|
|
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};
|
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
|
|
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};
|
package/lib/type/index.d.ts
CHANGED
|
@@ -16,6 +16,13 @@ declare const classNames: (...args: ClassValue[]) => string;
|
|
|
16
16
|
*/
|
|
17
17
|
declare const emptyImgBase64 = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* 删除一个dom节点
|
|
21
|
+
* @param dom
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
24
|
+
declare const delDom: (dom: Element) => void;
|
|
25
|
+
|
|
19
26
|
/**
|
|
20
27
|
* 获取 1*1 像素的透明图片
|
|
21
28
|
* @returns dom
|
|
@@ -105,4 +112,4 @@ declare const addEventListenerMultiple: <T extends HTMLElement = HTMLElement>(do
|
|
|
105
112
|
*/
|
|
106
113
|
declare function addStyleSheet(cssStr: string): () => void;
|
|
107
114
|
|
|
108
|
-
export { type CommonDOMEventTypes, type EventListenerOptions, type TEventMap, addEventListener, addEventListenerMultiple, addStyleSheet, classNames, emptyImgBase64, getEmptyImage };
|
|
115
|
+
export { type CommonDOMEventTypes, type EventListenerOptions, type TEventMap, addEventListener, addEventListenerMultiple, addStyleSheet, classNames, delDom, emptyImgBase64, getEmptyImage };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cclr/front",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
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": "ccf build"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "5463a4bf24b98f18f5e349347c9b048f2670c990",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@cclr/lang": "0.1.
|
|
33
|
-
"@cclr/utils": "0.1.
|
|
32
|
+
"@cclr/lang": "0.1.17",
|
|
33
|
+
"@cclr/utils": "0.1.17"
|
|
34
34
|
}
|
|
35
35
|
}
|