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