@domql/element 2.5.78 → 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;
@@ -54,7 +54,9 @@ const UPDATE_DEFAULT_OPTIONS = {
54
54
  excludes: import_utils2.METHODS_EXL
55
55
  };
56
56
  const update = function(params = {}, opts = UPDATE_DEFAULT_OPTIONS) {
57
- const options = (0, import_utils2.deepClone)((0, import_utils2.deepMerge)(opts, UPDATE_DEFAULT_OPTIONS));
57
+ const calleeElementCache = opts.calleeElement;
58
+ const options = (0, import_utils2.deepClone)((0, import_utils2.deepMerge)(opts, UPDATE_DEFAULT_OPTIONS), ["calleeElement"]);
59
+ options.calleeElement = calleeElementCache;
58
60
  const element = this;
59
61
  const { parent, node, key } = element;
60
62
  const { excludes, preventInheritAtCurrentState } = options;
@@ -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
  }
@@ -36,7 +36,7 @@ var import_state = require("@domql/state");
36
36
  var import_props = require("../props");
37
37
  var import_methods = require("../methods");
38
38
  const METHODS_EXL = (0, import_utils.joinArrays)(
39
- ["node", "state", "context", "extend"],
39
+ ["node", "state", "context", "extend", "__element"],
40
40
  import_methods.METHODS,
41
41
  import_state.IGNORE_STATE_PARAMS,
42
42
  import_props.IGNORE_PROPS_PARAMS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/element",
3
- "version": "2.5.78",
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": "053f137856aad06574e99486357f486d6d724132",
34
+ "gitHead": "d459c82294b8af698a706e4310cce67878e0969f",
35
35
  "devDependencies": {
36
36
  "@babel/core": "^7.12.0"
37
37
  }
package/update.js CHANGED
@@ -40,7 +40,9 @@ const UPDATE_DEFAULT_OPTIONS = {
40
40
  }
41
41
 
42
42
  const update = function (params = {}, opts = UPDATE_DEFAULT_OPTIONS) {
43
- const options = deepClone(deepMerge(opts, UPDATE_DEFAULT_OPTIONS))
43
+ const calleeElementCache = opts.calleeElement
44
+ const options = deepClone(deepMerge(opts, UPDATE_DEFAULT_OPTIONS), ['calleeElement'])
45
+ options.calleeElement = calleeElementCache
44
46
  const element = this
45
47
  const { parent, node, key } = element
46
48
  const { excludes, preventInheritAtCurrentState } = options
@@ -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
  }
package/utils/object.js CHANGED
@@ -6,7 +6,7 @@ import { IGNORE_PROPS_PARAMS } from '../props'
6
6
  import { METHODS } from '../methods'
7
7
 
8
8
  export const METHODS_EXL = joinArrays(
9
- ['node', 'state', 'context', 'extend'],
9
+ ['node', 'state', 'context', 'extend', '__element'],
10
10
  METHODS,
11
11
  IGNORE_STATE_PARAMS,
12
12
  IGNORE_PROPS_PARAMS