@whitesev/utils 1.9.5 → 1.9.7

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.
Files changed (33) hide show
  1. package/dist/index.amd.js +8 -15
  2. package/dist/index.amd.js.map +1 -1
  3. package/dist/index.cjs.js +8 -15
  4. package/dist/index.cjs.js.map +1 -1
  5. package/dist/index.esm.js +8 -15
  6. package/dist/index.esm.js.map +1 -1
  7. package/dist/index.iife.js +8 -15
  8. package/dist/index.iife.js.map +1 -1
  9. package/dist/index.system.js +8 -15
  10. package/dist/index.system.js.map +1 -1
  11. package/dist/index.umd.js +8 -15
  12. package/dist/index.umd.js.map +1 -1
  13. package/package.json +2 -2
  14. /package/dist/{index.d.ts → types/index.d.ts} +0 -0
  15. /package/dist/{src → types/src}/AjaxHookerType.d.ts +0 -0
  16. /package/dist/{src → types/src}/ColorConversion.d.ts +0 -0
  17. /package/dist/{src → types/src}/Dictionary.d.ts +0 -0
  18. /package/dist/{src → types/src}/Event.d.ts +0 -0
  19. /package/dist/{src → types/src}/GBKEncoder.d.ts +0 -0
  20. /package/dist/{src → types/src}/Hooks.d.ts +0 -0
  21. /package/dist/{src → types/src}/Httpx.d.ts +0 -0
  22. /package/dist/{src → types/src}/LockFunction.d.ts +0 -0
  23. /package/dist/{src → types/src}/Log.d.ts +0 -0
  24. /package/dist/{src → types/src}/Progress.d.ts +0 -0
  25. /package/dist/{src → types/src}/TryCatch.d.ts +0 -0
  26. /package/dist/{src → types/src}/Utils.d.ts +0 -0
  27. /package/dist/{src → types/src}/UtilsCommon.d.ts +0 -0
  28. /package/dist/{src → types/src}/UtilsCore.d.ts +0 -0
  29. /package/dist/{src → types/src}/UtilsGMCookie.d.ts +0 -0
  30. /package/dist/{src → types/src}/UtilsGMMenu.d.ts +0 -0
  31. /package/dist/{src → types/src}/VueObject.d.ts +0 -0
  32. /package/dist/{src → types/src}/ajaxHooker/ajaxHooker.d.ts +0 -0
  33. /package/dist/{src → types/src}/indexedDB.d.ts +0 -0
@@ -3818,7 +3818,9 @@ var Utils = (function () {
3818
3818
  /* CODE FOR BROWSERS THAT SUPPORT window.find */
3819
3819
  let windowFind = UtilsCore.self.find;
3820
3820
  strFound = windowFind(str, caseSensitive, true, true, false);
3821
- if (strFound && UtilsCore.self.getSelection && !UtilsCore.self.getSelection().anchorNode) {
3821
+ if (strFound &&
3822
+ UtilsCore.self.getSelection &&
3823
+ !UtilsCore.self.getSelection().anchorNode) {
3822
3824
  strFound = windowFind(str, caseSensitive, true, true, false);
3823
3825
  }
3824
3826
  if (!strFound) {
@@ -4890,7 +4892,8 @@ var Utils = (function () {
4890
4892
  return result;
4891
4893
  }
4892
4894
  isThemeDark() {
4893
- return UtilsCore.globalThis.matchMedia("(prefers-color-scheme: dark)").matches;
4895
+ return UtilsCore.globalThis.matchMedia("(prefers-color-scheme: dark)")
4896
+ .matches;
4894
4897
  }
4895
4898
  isVisible(element, inView = false) {
4896
4899
  let needCheckDomList = [];
@@ -5089,11 +5092,6 @@ var Utils = (function () {
5089
5092
  }
5090
5093
  mutationObserver(target, observer_config) {
5091
5094
  let UtilsContext = this;
5092
- if (!(target instanceof Node) &&
5093
- !(target instanceof NodeList) &&
5094
- !UtilsContext.isJQuery(target)) {
5095
- throw new Error("Utils.mutationObserver 参数 target 必须为 Node|NodeList|jQuery类型");
5096
- }
5097
5095
  let default_obverser_config = {
5098
5096
  /* 监听到元素有反馈,需执行的函数 */
5099
5097
  callback: () => { },
@@ -5142,12 +5140,8 @@ var Utils = (function () {
5142
5140
  let mutationObserver = new windowMutationObserver(function (mutations, observer) {
5143
5141
  observer_config?.callback(mutations, observer);
5144
5142
  });
5145
- if (target instanceof Node) {
5146
- /* 传入的参数是节点元素 */
5147
- mutationObserver.observe(target, observer_config.config);
5148
- }
5149
- else if (target instanceof NodeList) {
5150
- /* 传入的参数是节点元素数组 */
5143
+ if (Array.isArray(target) || target instanceof NodeList) {
5144
+ // 传入的是数组或者元素数组
5151
5145
  target.forEach((item) => {
5152
5146
  mutationObserver.observe(item, observer_config.config);
5153
5147
  });
@@ -5159,8 +5153,7 @@ var Utils = (function () {
5159
5153
  });
5160
5154
  }
5161
5155
  else {
5162
- /* 未知 */
5163
- console.error("Utils.mutationObserver 未知参数", arguments);
5156
+ mutationObserver.observe(target, observer_config.config);
5164
5157
  }
5165
5158
  if (observer_config.immediate) {
5166
5159
  /* 主动触发一次 */