@whitesev/pops 1.1.0 → 1.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
@@ -1495,6 +1495,12 @@
1495
1495
  }
1496
1496
  assign(target = {}, source = {}, isAdd = false) {
1497
1497
  let UtilsContext = this;
1498
+ if (source == null) {
1499
+ return target;
1500
+ }
1501
+ if (target == null) {
1502
+ target = {};
1503
+ }
1498
1504
  if (Array.isArray(source)) {
1499
1505
  let canTraverse = source.filter((item) => {
1500
1506
  return typeof item === "object";
@@ -1508,8 +1514,9 @@
1508
1514
  const targetKeyName = sourceKeyName;
1509
1515
  let targetValue = target[targetKeyName];
1510
1516
  let sourceValue = source[sourceKeyName];
1511
- if (sourceKeyName in target &&
1512
- typeof sourceValue === "object" &&
1517
+ if (typeof sourceValue === "object" &&
1518
+ sourceValue != null &&
1519
+ sourceKeyName in target &&
1513
1520
  !UtilsContext.isDOM(sourceValue)) {
1514
1521
  /* 源端的值是object类型,且不是元素节点 */
1515
1522
  target[sourceKeyName] = UtilsContext.assign(targetValue, sourceValue, isAdd);
@@ -1524,6 +1531,7 @@
1524
1531
  let targetValue = target[targetKeyName];
1525
1532
  let sourceValue = source[targetKeyName];
1526
1533
  if (typeof sourceValue === "object" &&
1534
+ sourceValue != null &&
1527
1535
  !UtilsContext.isDOM(sourceValue) &&
1528
1536
  Object.keys(sourceValue).length) {
1529
1537
  /* 源端的值是object类型,且不是元素节点 */
@@ -8960,11 +8968,13 @@
8960
8968
  popsDOMUtils.on(globalThis, "click touchstart", void 0, PopsContextMenu.windowCheckClickEvent, {
8961
8969
  capture: true,
8962
8970
  });
8963
- const $shadowRoot = config.target.getRootNode();
8964
- if ($shadowRoot instanceof ShadowRoot) {
8965
- popsDOMUtils.on($shadowRoot, "click touchstart", void 0, PopsContextMenu.shadowRootCheckClickEvent, {
8966
- capture: true,
8967
- });
8971
+ if (config.target instanceof Node) {
8972
+ const $shadowRoot = config.target.getRootNode();
8973
+ if ($shadowRoot instanceof ShadowRoot) {
8974
+ popsDOMUtils.on($shadowRoot, "click touchstart", void 0, PopsContextMenu.shadowRootCheckClickEvent, {
8975
+ capture: true,
8976
+ });
8977
+ }
8968
8978
  }
8969
8979
  },
8970
8980
  /**
@@ -8974,11 +8984,13 @@
8974
8984
  popsDOMUtils.off(globalThis, "click touchstart", void 0, PopsContextMenu.windowCheckClickEvent, {
8975
8985
  capture: true,
8976
8986
  });
8977
- const $shadowRoot = config.target.getRootNode();
8978
- if ($shadowRoot instanceof ShadowRoot) {
8979
- popsDOMUtils.off($shadowRoot, "click touchstart", void 0, PopsContextMenu.windowCheckClickEvent, {
8980
- capture: true,
8981
- });
8987
+ if (config.target instanceof Node) {
8988
+ const $shadowRoot = config.target.getRootNode();
8989
+ if ($shadowRoot instanceof ShadowRoot) {
8990
+ popsDOMUtils.off($shadowRoot, "click touchstart", void 0, PopsContextMenu.windowCheckClickEvent, {
8991
+ capture: true,
8992
+ });
8993
+ }
8982
8994
  }
8983
8995
  },
8984
8996
  /**
@@ -9921,7 +9933,7 @@
9921
9933
  /** 配置 */
9922
9934
  config = {
9923
9935
  /** 版本号 */
9924
- version: "2024.7.8",
9936
+ version: "2024.7.14",
9925
9937
  cssText: {
9926
9938
  /** 主CSS */
9927
9939
  index: indexCSS,