@whitesev/utils 2.2.0 → 2.2.1
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/dist/index.amd.js +14 -1
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +14 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +14 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +14 -1
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +14 -1
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +14 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/Utils.d.ts +1 -1
- package/package.json +1 -1
- package/src/Utils.ts +2 -3
package/dist/index.system.js
CHANGED
|
@@ -3554,7 +3554,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
3554
3554
|
this.windowApi = new WindowApi(option);
|
|
3555
3555
|
}
|
|
3556
3556
|
/** 版本号 */
|
|
3557
|
-
version = "2024.
|
|
3557
|
+
version = "2024.9.1";
|
|
3558
3558
|
addStyle(cssText) {
|
|
3559
3559
|
if (typeof cssText !== "string") {
|
|
3560
3560
|
throw new Error("Utils.addStyle 参数cssText 必须为String类型");
|
|
@@ -4938,6 +4938,19 @@ System.register('Utils', [], (function (exports) {
|
|
|
4938
4938
|
return this.windowApi.globalThis.matchMedia("(prefers-color-scheme: dark)")
|
|
4939
4939
|
.matches;
|
|
4940
4940
|
}
|
|
4941
|
+
/**
|
|
4942
|
+
* 判断元素是否在页面中可见
|
|
4943
|
+
* @param element 需要检查的元素,可以是普通元素|数组形式的元素|通过querySelectorAll获取的元素数组
|
|
4944
|
+
* @param inView
|
|
4945
|
+
* + true 在窗口可视区域
|
|
4946
|
+
* + false 不在窗口可视区域
|
|
4947
|
+
* @returns
|
|
4948
|
+
* + true 可见
|
|
4949
|
+
* + false 不可见
|
|
4950
|
+
* @example
|
|
4951
|
+
* Utils.isVisible(document.documentElement)
|
|
4952
|
+
* > true
|
|
4953
|
+
*/
|
|
4941
4954
|
isVisible(element, inView = false) {
|
|
4942
4955
|
let needCheckDomList = [];
|
|
4943
4956
|
if (element instanceof Array || element instanceof NodeList) {
|