@domql/element 2.5.79 → 2.5.82

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/create.js CHANGED
@@ -276,7 +276,7 @@ const createIfConditionFlag = (element, parent) => {
276
276
  }
277
277
 
278
278
  const addCaching = (element, parent) => {
279
- const { __ref: ref } = element
279
+ const { __ref: ref, key } = element
280
280
  let { __ref: parentRef } = parent
281
281
 
282
282
  // enable TRANSFORM in data
@@ -302,6 +302,8 @@ const addCaching = (element, parent) => {
302
302
  // enable CHANGES storing
303
303
  if (!ref.__children) ref.__children = []
304
304
 
305
+ if (checkIfKeyIsComponent(key)) ref.__componentKey = key.split('_')[0].split('.')[0].split('+')[0]
306
+
305
307
  // Add _root element property
306
308
  const hasRoot = parent && parent.key === ':root'
307
309
  if (!ref.root) ref.root = hasRoot ? element : parentRef.root
@@ -214,7 +214,7 @@ const createIfConditionFlag = (element, parent) => {
214
214
  ref.__if = true;
215
215
  };
216
216
  const addCaching = (element, parent) => {
217
- const { __ref: ref } = element;
217
+ const { __ref: ref, key } = element;
218
218
  let { __ref: parentRef } = parent;
219
219
  if (!element.transform)
220
220
  element.transform = {};
@@ -234,6 +234,8 @@ const addCaching = (element, parent) => {
234
234
  ref.__changes = [];
235
235
  if (!ref.__children)
236
236
  ref.__children = [];
237
+ if ((0, import_component.checkIfKeyIsComponent)(key))
238
+ ref.__componentKey = key.split("_")[0].split(".")[0].split("+")[0];
237
239
  const hasRoot = parent && parent.key === ":root";
238
240
  if (!ref.root)
239
241
  ref.root = hasRoot ? element : parentRef.root;
@@ -108,11 +108,15 @@ const cloneAndMergeArrayExtend = (stack) => {
108
108
  };
109
109
  const fallbackStringExtend = (extend, context, options = {}) => {
110
110
  const COMPONENTS = context && context.components || options.components;
111
+ const PAGES = context && context.pages || options.pages;
111
112
  if ((0, import_utils.isString)(extend)) {
112
- const componentExists = COMPONENTS[extend] || COMPONENTS["smbls." + extend];
113
- if (COMPONENTS && componentExists) {
113
+ const componentExists = COMPONENTS && (COMPONENTS[extend] || COMPONENTS["smbls." + extend]);
114
+ const pageExists = PAGES && extend.startsWith("/") && PAGES[extend];
115
+ if (componentExists)
114
116
  return componentExists;
115
- } else {
117
+ else if (pageExists)
118
+ return pageExists;
119
+ else {
116
120
  if (options.verbose && (ENV === "test" || ENV === "development")) {
117
121
  console.warn("Extend is string but component was not found:", extend);
118
122
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/element",
3
- "version": "2.5.79",
3
+ "version": "2.5.82",
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": "f8d79497e401e72f952090edb53f372bd6f109df",
34
+ "gitHead": "d459c82294b8af698a706e4310cce67878e0969f",
35
35
  "devDependencies": {
36
36
  "@babel/core": "^7.12.0"
37
37
  }
@@ -77,11 +77,13 @@ export const cloneAndMergeArrayExtend = stack => {
77
77
 
78
78
  export const fallbackStringExtend = (extend, context, options = {}) => {
79
79
  const COMPONENTS = (context && context.components) || options.components
80
+ const PAGES = (context && context.pages) || options.pages
80
81
  if (isString(extend)) {
81
- const componentExists = COMPONENTS[extend] || COMPONENTS['smbls.' + extend]
82
- if (COMPONENTS && componentExists) {
83
- return componentExists
84
- } else {
82
+ const componentExists = COMPONENTS && (COMPONENTS[extend] || COMPONENTS['smbls.' + extend])
83
+ const pageExists = PAGES && extend.startsWith('/') && PAGES[extend]
84
+ if (componentExists) return componentExists
85
+ else if (pageExists) return pageExists
86
+ else {
85
87
  if (options.verbose && (ENV === 'test' || ENV === 'development')) {
86
88
  console.warn('Extend is string but component was not found:', extend)
87
89
  }