@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.esm.js CHANGED
@@ -1489,6 +1489,12 @@ class PopsUtils {
1489
1489
  }
1490
1490
  assign(target = {}, source = {}, isAdd = false) {
1491
1491
  let UtilsContext = this;
1492
+ if (source == null) {
1493
+ return target;
1494
+ }
1495
+ if (target == null) {
1496
+ target = {};
1497
+ }
1492
1498
  if (Array.isArray(source)) {
1493
1499
  let canTraverse = source.filter((item) => {
1494
1500
  return typeof item === "object";
@@ -1502,8 +1508,9 @@ class PopsUtils {
1502
1508
  const targetKeyName = sourceKeyName;
1503
1509
  let targetValue = target[targetKeyName];
1504
1510
  let sourceValue = source[sourceKeyName];
1505
- if (sourceKeyName in target &&
1506
- typeof sourceValue === "object" &&
1511
+ if (typeof sourceValue === "object" &&
1512
+ sourceValue != null &&
1513
+ sourceKeyName in target &&
1507
1514
  !UtilsContext.isDOM(sourceValue)) {
1508
1515
  /* 源端的值是object类型,且不是元素节点 */
1509
1516
  target[sourceKeyName] = UtilsContext.assign(targetValue, sourceValue, isAdd);
@@ -1518,6 +1525,7 @@ class PopsUtils {
1518
1525
  let targetValue = target[targetKeyName];
1519
1526
  let sourceValue = source[targetKeyName];
1520
1527
  if (typeof sourceValue === "object" &&
1528
+ sourceValue != null &&
1521
1529
  !UtilsContext.isDOM(sourceValue) &&
1522
1530
  Object.keys(sourceValue).length) {
1523
1531
  /* 源端的值是object类型,且不是元素节点 */
@@ -8954,11 +8962,13 @@ class PopsRightClickMenu {
8954
8962
  popsDOMUtils.on(globalThis, "click touchstart", void 0, PopsContextMenu.windowCheckClickEvent, {
8955
8963
  capture: true,
8956
8964
  });
8957
- const $shadowRoot = config.target.getRootNode();
8958
- if ($shadowRoot instanceof ShadowRoot) {
8959
- popsDOMUtils.on($shadowRoot, "click touchstart", void 0, PopsContextMenu.shadowRootCheckClickEvent, {
8960
- capture: true,
8961
- });
8965
+ if (config.target instanceof Node) {
8966
+ const $shadowRoot = config.target.getRootNode();
8967
+ if ($shadowRoot instanceof ShadowRoot) {
8968
+ popsDOMUtils.on($shadowRoot, "click touchstart", void 0, PopsContextMenu.shadowRootCheckClickEvent, {
8969
+ capture: true,
8970
+ });
8971
+ }
8962
8972
  }
8963
8973
  },
8964
8974
  /**
@@ -8968,11 +8978,13 @@ class PopsRightClickMenu {
8968
8978
  popsDOMUtils.off(globalThis, "click touchstart", void 0, PopsContextMenu.windowCheckClickEvent, {
8969
8979
  capture: true,
8970
8980
  });
8971
- const $shadowRoot = config.target.getRootNode();
8972
- if ($shadowRoot instanceof ShadowRoot) {
8973
- popsDOMUtils.off($shadowRoot, "click touchstart", void 0, PopsContextMenu.windowCheckClickEvent, {
8974
- capture: true,
8975
- });
8981
+ if (config.target instanceof Node) {
8982
+ const $shadowRoot = config.target.getRootNode();
8983
+ if ($shadowRoot instanceof ShadowRoot) {
8984
+ popsDOMUtils.off($shadowRoot, "click touchstart", void 0, PopsContextMenu.windowCheckClickEvent, {
8985
+ capture: true,
8986
+ });
8987
+ }
8976
8988
  }
8977
8989
  },
8978
8990
  /**
@@ -9915,7 +9927,7 @@ class Pops {
9915
9927
  /** 配置 */
9916
9928
  config = {
9917
9929
  /** 版本号 */
9918
- version: "2024.7.8",
9930
+ version: "2024.7.14",
9919
9931
  cssText: {
9920
9932
  /** 主CSS */
9921
9933
  index: indexCSS,