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