@domql/element 2.5.50 → 2.5.51

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.
@@ -147,7 +147,6 @@ const captureSnapshot = (element, options) => {
147
147
  return [snapshotOnCallee, calleeElement];
148
148
  };
149
149
  const checkIfOnUpdate = (element, parent, options) => {
150
- var _a;
151
150
  if (!(0, import_utils.isFunction)(element.if) || !parent)
152
151
  return;
153
152
  const ref = element.__ref;
@@ -163,13 +162,15 @@ const checkIfOnUpdate = (element, parent, options) => {
163
162
  }
164
163
  if (ref.__state) {
165
164
  element.state = ref.__state;
165
+ } else if (!ref.__hasRootState) {
166
+ delete element.state;
166
167
  }
167
- (_a = element.node) == null ? void 0 : _a.remove();
168
+ element.node && element.node.remove();
168
169
  const previousElement = element.previousElement();
169
170
  const nextElement = element.nextElement();
170
171
  const hasPrevious = previousElement && previousElement.node;
171
172
  const hasNext = nextElement && nextElement.node;
172
- const attachOptions = ((hasPrevious == null ? void 0 : hasPrevious.parentNode) || (hasNext == null ? void 0 : hasNext.parentNode)) && {
173
+ const attachOptions = (hasPrevious && hasPrevious.parentNode || hasNext && hasNext.parentNode) && {
173
174
  position: hasPrevious ? "after" : hasNext ? "before" : null,
174
175
  node: hasPrevious || hasNext
175
176
  };
@@ -80,7 +80,7 @@ const extendizeByKey = (element, parent, key) => {
80
80
  const { context, tag, extend, props, attr, state, childExtend, childProps, on, if: condition } = element;
81
81
  const hasComponentAttrs = extend || childExtend || props || state || on || condition || attr;
82
82
  const extendFromKey = key.includes("+") ? key.split("+") : key.includes("_") ? key.split("_")[0] : key.includes(".") ? key.split(".")[0] : [key];
83
- const isExtendKeyComponent = context == null ? void 0 : context.components[extendFromKey];
83
+ const isExtendKeyComponent = context && context.components[extendFromKey];
84
84
  if (element === isExtendKeyComponent)
85
85
  return element;
86
86
  else if (!hasComponentAttrs || childProps) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/element",
3
- "version": "2.5.50",
3
+ "version": "2.5.51",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "index.js",
@@ -31,7 +31,7 @@
31
31
  "@domql/state": "latest",
32
32
  "@domql/utils": "latest"
33
33
  },
34
- "gitHead": "6fa0575bec43db642ce4846641729459984339b6",
34
+ "gitHead": "75eb8c4728c904ec9f050a2eb9816502196caef9",
35
35
  "devDependencies": {
36
36
  "@babel/core": "^7.12.0"
37
37
  }
package/update.js CHANGED
@@ -170,11 +170,14 @@ const checkIfOnUpdate = (element, parent, options) => {
170
170
  if (!ref.__hasRootState) {
171
171
  delete element.state
172
172
  }
173
+
173
174
  if (ref.__state) {
174
175
  element.state = ref.__state
176
+ } else if (!ref.__hasRootState) {
177
+ delete element.state
175
178
  }
176
179
 
177
- element.node?.remove()
180
+ element.node && element.node.remove()
178
181
 
179
182
  const previousElement = element.previousElement()
180
183
  const nextElement = element.nextElement()
@@ -182,7 +185,7 @@ const checkIfOnUpdate = (element, parent, options) => {
182
185
  const hasPrevious = previousElement && previousElement.node
183
186
  const hasNext = nextElement && nextElement.node
184
187
 
185
- const attachOptions = (hasPrevious?.parentNode || hasNext?.parentNode) && {
188
+ const attachOptions = ((hasPrevious && hasPrevious.parentNode) || (hasNext && hasNext.parentNode)) && {
186
189
  position: hasPrevious ? 'after' : hasNext ? 'before' : null,
187
190
  node: hasPrevious || hasNext
188
191
  }
@@ -60,7 +60,7 @@ export const extendizeByKey = (element, parent, key) => {
60
60
  ? key.split('.')[0] // get component key split .
61
61
  : [key]
62
62
 
63
- const isExtendKeyComponent = context?.components[extendFromKey]
63
+ const isExtendKeyComponent = context && context.components[extendFromKey]
64
64
 
65
65
  if (element === isExtendKeyComponent) return element
66
66
  else if (!hasComponentAttrs || childProps) {