@domql/element 2.5.93 → 2.5.96

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.
@@ -28,7 +28,8 @@ let mainExtend;
28
28
  const applyExtend = (element, parent, options = {}) => {
29
29
  if ((0, import_utils.isFunction)(element))
30
30
  element = (0, import_utils.exec)(element, parent);
31
- let { extend, props, context, __ref } = element;
31
+ let { extend, props, __ref } = element;
32
+ const context = element.context || parent.context;
32
33
  extend = (0, import_utils2.fallbackStringExtend)(extend, context, options);
33
34
  const extendStack = (0, import_utils2.getExtendStack)(extend, context);
34
35
  if (ENV !== "test" || ENV !== "development")
@@ -93,9 +93,10 @@ const createValidDomqlObjectFromSugar = (el, parent, key, options) => {
93
93
  return newElem;
94
94
  };
95
95
  const extendizeByKey = (element, parent, key) => {
96
- const { context, tag, extend, props, attr, state, childExtend, childProps, on, if: condition, data } = element;
96
+ const { context } = parent;
97
+ const { tag, extend, props, attr, state, childExtend, childProps, on, if: condition, data } = element;
97
98
  const hasComponentAttrs = extend || childExtend || props || state || on || condition || attr || data;
98
- const extendFromKey = key.includes("+") ? key.split("+") : key.includes("_") ? key.split("_")[0] : key.includes(".") ? key.split(".")[0] : [key];
99
+ const extendFromKey = key.includes("+") ? key.split("+") : key.includes("_") ? [key.split("_")[0]] : key.includes(".") && !checkIfKeyIsComponent(key.split(".")[1]) ? [key.split(".")[0]] : [key];
99
100
  const isExtendKeyComponent = context && context.components[extendFromKey];
100
101
  if (element === isExtendKeyComponent)
101
102
  return element;
package/extend.js CHANGED
@@ -20,7 +20,8 @@ let mainExtend
20
20
  export const applyExtend = (element, parent, options = {}) => {
21
21
  if (isFunction(element)) element = exec(element, parent)
22
22
 
23
- let { extend, props, context, __ref } = element
23
+ let { extend, props, __ref } = element
24
+ const context = element.context || parent.context
24
25
 
25
26
  extend = fallbackStringExtend(extend, context, options)
26
27
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/element",
3
- "version": "2.5.93",
3
+ "version": "2.5.96",
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": "6c5a9e10c74137700ad69ff9108b6ccc09745cc7",
34
+ "gitHead": "0cecd2c613b24dde1ea12f7e7581a58671dc3ad3",
35
35
  "devDependencies": {
36
36
  "@babel/core": "^7.12.0"
37
37
  }
@@ -66,17 +66,21 @@ export const createValidDomqlObjectFromSugar = (el, parent, key, options) => {
66
66
  }
67
67
 
68
68
  export const extendizeByKey = (element, parent, key) => {
69
- const { context, tag, extend, props, attr, state, childExtend, childProps, on, if: condition, data } = element
69
+ const { context } = parent
70
+ const { tag, extend, props, attr, state, childExtend, childProps, on, if: condition, data } = element
70
71
  const hasComponentAttrs = extend || childExtend || props || state || on || condition || attr || data
71
72
 
72
73
  const extendFromKey = key.includes('+')
73
74
  ? key.split('+') // get array of componentKeys
74
75
  : key.includes('_')
75
- ? key.split('_')[0] // get component key split _
76
- : key.includes('.') // TODO: add only Component.camelCase cases - avoud Component.Variant
77
- ? key.split('.')[0] // get component key split .
76
+ ? [key.split('_')[0]] // get component key split _
77
+ : key.includes('.') && !checkIfKeyIsComponent(key.split('.')[1])
78
+ ? [key.split('.')[0]] // get component key split .
78
79
  : [key]
79
80
 
81
+ // console.log(extendFromKey)
82
+ // console.log(context, context?.components)
83
+ // console.log(element)
80
84
  const isExtendKeyComponent = context && context.components[extendFromKey]
81
85
 
82
86
  if (element === isExtendKeyComponent) return element