@domql/utils 2.5.151 → 2.5.152

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/component.js CHANGED
@@ -6,10 +6,8 @@ import {
6
6
  isArray,
7
7
  isFunction,
8
8
  isObject,
9
- isObjectLike,
10
9
  isString,
11
- joinArrays,
12
- overwriteDeep
10
+ joinArrays
13
11
  } from '.'
14
12
  const ENV = process.env.NODE_ENV
15
13
 
@@ -109,20 +107,24 @@ export const addChildrenIfNotInOriginal = (element, parent, key) => {
109
107
  const childKey = childElems[i]
110
108
  const childElem = element[childKey]
111
109
  const newChild = element.props[childKey]
110
+
111
+ const assignChild = (val) => {
112
+ element[childKey] = val
113
+ delete element.props[childKey]
114
+ }
115
+
112
116
  if (newChild?.ignoreExtend) continue
113
- if (!childElem) element[childKey] = deepCloneWithExtend(newChild)
117
+ if (newChild === null && childElem) {
118
+ console.log('is null', element)
119
+ assignChild(null)
120
+ } else if (!childElem) assignChild(deepCloneWithExtend(newChild))
114
121
  else {
115
- const isSugar = checkIfSugar(childElem, parent, key)
116
- if (!isSugar) continue
117
- const inheritedChildElem = element[childKey].props
118
- if (isObjectLike(newChild)) {
119
- overwriteDeep(inheritedChildElem, newChild)
120
- } else if (isFunction(newChild)) {
121
- element[childKey] = {
122
- extend: element[childKey],
123
- props: newChild
124
- }
125
- }
122
+ const isSugarChildElem = checkIfSugar(childElem, parent, key)
123
+ if (isSugarChildElem) continue
124
+ assignChild({
125
+ extend: element[childKey],
126
+ props: newChild
127
+ })
126
128
  }
127
129
  }
128
130
  }
@@ -121,23 +121,25 @@ const addChildrenIfNotInOriginal = (element, parent, key) => {
121
121
  const childKey = childElems[i];
122
122
  const childElem = element[childKey];
123
123
  const newChild = element.props[childKey];
124
+ const assignChild = (val) => {
125
+ element[childKey] = val;
126
+ delete element.props[childKey];
127
+ };
124
128
  if (newChild == null ? void 0 : newChild.ignoreExtend)
125
129
  continue;
126
- if (!childElem)
127
- element[childKey] = (0, import__.deepCloneWithExtend)(newChild);
130
+ if (newChild === null && childElem) {
131
+ console.log("is null", element);
132
+ assignChild(null);
133
+ } else if (!childElem)
134
+ assignChild((0, import__.deepCloneWithExtend)(newChild));
128
135
  else {
129
- const isSugar = checkIfSugar(childElem, parent, key);
130
- if (!isSugar)
136
+ const isSugarChildElem = checkIfSugar(childElem, parent, key);
137
+ if (isSugarChildElem)
131
138
  continue;
132
- const inheritedChildElem = element[childKey].props;
133
- if ((0, import__.isObjectLike)(newChild)) {
134
- (0, import__.overwriteDeep)(inheritedChildElem, newChild);
135
- } else if ((0, import__.isFunction)(newChild)) {
136
- element[childKey] = {
137
- extend: element[childKey],
138
- props: newChild
139
- };
140
- }
139
+ assignChild({
140
+ extend: element[childKey],
141
+ props: newChild
142
+ });
141
143
  }
142
144
  }
143
145
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/utils",
3
- "version": "2.5.151",
3
+ "version": "2.5.152",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "index.js",
@@ -25,7 +25,7 @@
25
25
  "build": "yarn build:cjs",
26
26
  "prepublish": "rimraf -I dist && yarn build && yarn copy:package:cjs"
27
27
  },
28
- "gitHead": "f37b51f84b8bca80b8bce7887e83d61ac25eb3d5",
28
+ "gitHead": "249d2545f3ee35b450ca90d399fc7c3e54a4a7bc",
29
29
  "devDependencies": {
30
30
  "@babel/core": "^7.12.0"
31
31
  }