@domql/element 2.5.179 → 2.5.180

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.
@@ -30,8 +30,9 @@ const applyExtend = (element, parent, options = {}) => {
30
30
  element = (0, import_utils.exec)(element, parent);
31
31
  const { props, __ref } = element;
32
32
  let extend = (props == null ? void 0 : props.extends) || element.extends || element.extend;
33
+ const variant = props == null ? void 0 : props.variant;
33
34
  const context = element.context || parent.context;
34
- extend = (0, import_utils2.fallbackStringExtend)(extend, context, options);
35
+ extend = (0, import_utils2.fallbackStringExtend)(extend, context, options, variant);
35
36
  const extendStack = (0, import_utils2.getExtendStack)(extend, context);
36
37
  if (ENV !== "test" || ENV !== "development")
37
38
  delete element.extend;
@@ -106,11 +106,11 @@ const cloneAndMergeArrayExtend = (stack) => {
106
106
  return deepMergeExtend(a, (0, import_utils.deepClone)(c));
107
107
  }, {});
108
108
  };
109
- const fallbackStringExtend = (extend, context, options = {}) => {
109
+ const fallbackStringExtend = (extend, context, options = {}, variant) => {
110
110
  const COMPONENTS = context && context.components || options.components;
111
111
  const PAGES = context && context.pages || options.pages;
112
112
  if ((0, import_utils.isString)(extend)) {
113
- const componentExists = COMPONENTS && (COMPONENTS[extend] || COMPONENTS["smbls." + extend]);
113
+ const componentExists = COMPONENTS && (COMPONENTS[extend + "." + variant] || COMPONENTS[extend] || COMPONENTS["smbls." + extend]);
114
114
  const pageExists = PAGES && extend.startsWith("/") && PAGES[extend];
115
115
  if (componentExists)
116
116
  return componentExists;
package/extend.js CHANGED
@@ -22,9 +22,10 @@ export const applyExtend = (element, parent, options = {}) => {
22
22
 
23
23
  const { props, __ref } = element
24
24
  let extend = props?.extends || element.extends || element.extend
25
+ const variant = props?.variant
25
26
  const context = element.context || parent.context
26
27
 
27
- extend = fallbackStringExtend(extend, context, options)
28
+ extend = fallbackStringExtend(extend, context, options, variant)
28
29
 
29
30
  const extendStack = getExtendStack(extend, context)
30
31
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/element",
3
- "version": "2.5.179",
3
+ "version": "2.5.180",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "index.js",
@@ -31,7 +31,7 @@
31
31
  "@domql/state": "^2.5.179",
32
32
  "@domql/utils": "^2.5.179"
33
33
  },
34
- "gitHead": "6dd81dc7848b03bd9bf564dbc82cd95af713ae21",
34
+ "gitHead": "65c5011c956baa7e561d7ad5f39197ef6bfdab0a",
35
35
  "devDependencies": {
36
36
  "@babel/core": "^7.12.0"
37
37
  }
@@ -75,11 +75,15 @@ export const cloneAndMergeArrayExtend = stack => {
75
75
  }, {})
76
76
  }
77
77
 
78
- export const fallbackStringExtend = (extend, context, options = {}) => {
78
+ export const fallbackStringExtend = (extend, context, options = {}, variant) => {
79
79
  const COMPONENTS = (context && context.components) || options.components
80
80
  const PAGES = (context && context.pages) || options.pages
81
81
  if (isString(extend)) {
82
- const componentExists = COMPONENTS && (COMPONENTS[extend] || COMPONENTS['smbls.' + extend])
82
+ const componentExists = COMPONENTS && (
83
+ COMPONENTS[extend + '.' + variant] ||
84
+ COMPONENTS[extend] ||
85
+ COMPONENTS['smbls.' + extend]
86
+ )
83
87
  const pageExists = PAGES && extend.startsWith('/') && PAGES[extend]
84
88
  if (componentExists) return componentExists
85
89
  else if (pageExists) return pageExists