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