@domql/element 2.5.42 → 2.5.44

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.
@@ -24,6 +24,7 @@ module.exports = __toCommonJS(extend_exports);
24
24
  var import_utils = require("@domql/utils");
25
25
  var import_utils2 = require("./utils");
26
26
  const ENV = "development";
27
+ let mainExtend;
27
28
  const applyExtend = (element, parent, options = {}) => {
28
29
  if ((0, import_utils.isFunction)(element))
29
30
  element = (0, import_utils.exec)(element, parent);
@@ -60,8 +61,12 @@ const applyExtend = (element, parent, options = {}) => {
60
61
  } else if (!options.extend)
61
62
  return element;
62
63
  if (options.extend) {
63
- const defaultOptionsExtend = (0, import_utils2.getExtendStack)(options.extend, context);
64
- stack = [].concat(stack, defaultOptionsExtend);
64
+ if (!mainExtend) {
65
+ const defaultOptionsExtend = (0, import_utils2.getExtendStack)(options.extend, context);
66
+ mainExtend = (0, import_utils2.cloneAndMergeArrayExtend)(defaultOptionsExtend);
67
+ delete mainExtend.extend;
68
+ }
69
+ stack = [].concat(stack, mainExtend);
65
70
  }
66
71
  if (__ref)
67
72
  __ref.__extend = stack;
@@ -72,5 +77,6 @@ const applyExtend = (element, parent, options = {}) => {
72
77
  const componentExtend = (0, import_utils2.cloneAndMergeArrayExtend)((0, import_utils2.getExtendStack)(COMPONENTS[component]));
73
78
  mergedExtend = (0, import_utils2.deepMergeExtend)(componentExtend, mergedExtend);
74
79
  }
75
- return (0, import_utils2.deepMergeExtend)(element, mergedExtend);
80
+ const merged = (0, import_utils2.deepMergeExtend)(element, mergedExtend);
81
+ return merged;
76
82
  };
@@ -49,7 +49,7 @@ const addAdditionalExtend = (newExtend, element) => {
49
49
  const extendizeByKey = (element, parent, key) => {
50
50
  const { context, tag, extend, props, attr, state, childExtend, childProps, on, if: condition } = element;
51
51
  const hasComponentAttrs = extend || childExtend || props || state || on || condition || attr;
52
- const extendFromKey = key.includes("+") ? key.split("+") : key.includes("_") ? key.split("_")[0] : key.includes(".") ? key.split(".")[0] : key;
52
+ const extendFromKey = key.includes("+") ? key.split("+") : key.includes("_") ? key.split("_")[0] : key.includes(".") ? key.split(".")[0] : [key];
53
53
  const isExtendKeyComponent = context == null ? void 0 : context.components[extendFromKey];
54
54
  if (element === isExtendKeyComponent)
55
55
  return element;
package/extend.js CHANGED
@@ -11,6 +11,8 @@ import {
11
11
 
12
12
  const ENV = process.env.NODE_ENV
13
13
 
14
+ let mainExtend
15
+
14
16
  /**
15
17
  * Checks whether element has `extend` or is a part
16
18
  * of parent's `childExtend` extend
@@ -59,8 +61,12 @@ export const applyExtend = (element, parent, options = {}) => {
59
61
  } else if (!options.extend) return element
60
62
 
61
63
  if (options.extend) {
62
- const defaultOptionsExtend = getExtendStack(options.extend, context)
63
- stack = [].concat(stack, defaultOptionsExtend)
64
+ if (!mainExtend) {
65
+ const defaultOptionsExtend = getExtendStack(options.extend, context)
66
+ mainExtend = cloneAndMergeArrayExtend(defaultOptionsExtend)
67
+ delete mainExtend.extend
68
+ }
69
+ stack = [].concat(stack, mainExtend)
64
70
  }
65
71
 
66
72
  // check if array contains string extends
@@ -75,5 +81,6 @@ export const applyExtend = (element, parent, options = {}) => {
75
81
  mergedExtend = deepMergeExtend(componentExtend, mergedExtend)
76
82
  }
77
83
 
78
- return deepMergeExtend(element, mergedExtend)
84
+ const merged = deepMergeExtend(element, mergedExtend)
85
+ return merged
79
86
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/element",
3
- "version": "2.5.42",
3
+ "version": "2.5.44",
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": "76fbbf8ab997ee90fc3a791b21e49677d1b53993",
34
+ "gitHead": "117c38ec4e18952323fe5a7bd60f482050550efa",
35
35
  "devDependencies": {
36
36
  "@babel/core": "^7.12.0"
37
37
  }
package/set.js CHANGED
@@ -14,7 +14,7 @@ const set = function (params, options = {}, el) {
14
14
  const lazyLoad = element.props && element.props.lazyLoad
15
15
 
16
16
  if (options.preventContentUpdate === true) return
17
-
17
+
18
18
  if (ref.__noCollectionDifference || (__contentRef && __contentRef.__cached && deepContains(params, content))) {
19
19
  return content.update()
20
20
  }
@@ -29,7 +29,7 @@ export const extendizeByKey = (element, parent, key) => {
29
29
  ? key.split('_')[0]
30
30
  : key.includes('.')
31
31
  ? key.split('.')[0]
32
- : key
32
+ : [key]
33
33
 
34
34
  const isExtendKeyComponent = context?.components[extendFromKey]
35
35