@domql/element 2.5.56 → 2.5.57

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/dist/cjs/set.js CHANGED
@@ -41,7 +41,8 @@ const set = function(params, options = {}, el) {
41
41
  const { __ref: ref, content } = element;
42
42
  const __contentRef = content && content.__ref;
43
43
  const lazyLoad = element.props && element.props.lazyLoad;
44
- if (options.preventContentUpdate === true)
44
+ const hasCollection = element.$collection || element.$stateCollection || element.$propsCollection;
45
+ if (options.preventContentUpdate === true && !hasCollection)
45
46
  return;
46
47
  if (ref.__noCollectionDifference || __contentRef && __contentRef.__cached && (0, import_utils.deepContains)(params, content)) {
47
48
  return content.update();
@@ -57,7 +57,8 @@ const update = function(params = {}, options = UPDATE_DEFAULT_OPTIONS) {
57
57
  const element = this;
58
58
  const { parent, node, key } = element;
59
59
  const { excludes, preventInheritAtCurrentState } = options;
60
- (0, import_event.triggerEventOnUpdate)("startUpdate", params, element, options);
60
+ if (!options.preventListeners)
61
+ (0, import_event.triggerEventOnUpdate)("startUpdate", params, element, options);
61
62
  if (preventInheritAtCurrentState && preventInheritAtCurrentState.__element === element)
62
63
  return;
63
64
  if (!excludes)
@@ -84,15 +85,17 @@ const update = function(params = {}, options = UPDATE_DEFAULT_OPTIONS) {
84
85
  if (props)
85
86
  (0, import_props.updateProps)(props, element, parent);
86
87
  }
87
- if (!options.preventInitUpdateListener) {
88
+ if (!options.preventInitUpdateListener && !options.preventListeners) {
88
89
  const initUpdateReturns = (0, import_event.triggerEventOnUpdate)("initUpdate", params, element, options);
89
90
  if (initUpdateReturns === false)
90
91
  return element;
91
92
  }
92
93
  const overwriteChanges = (0, import_utils.overwriteDeep)(element, params, import_utils2.METHODS_EXL);
93
94
  const execChanges = (0, import_iterate.throughUpdatedExec)(element, { ignore: UPDATE_DEFAULT_OPTIONS });
95
+ if (element.key === "Navigation")
96
+ debugger;
94
97
  const definedChanges = (0, import_iterate.throughUpdatedDefine)(element);
95
- if (!options.isForced) {
98
+ if (!options.isForced && !options.preventListeners) {
96
99
  (0, import_event.triggerEventOn)("beforeClassAssign", element, options);
97
100
  }
98
101
  if (options.stackChanges && element.__stackChanges) {
@@ -109,7 +112,8 @@ const update = function(params = {}, options = UPDATE_DEFAULT_OPTIONS) {
109
112
  const hasOnlyUpdateFalsy = options.onlyUpdate && (options.onlyUpdate !== param || !element.lookup(options.onlyUpdate));
110
113
  const isInPreventUpdate = (0, import_utils.isArray)(options.preventUpdate) && options.preventUpdate.includes(param);
111
114
  const isInPreventDefineUpdate = (0, import_utils.isArray)(options.preventDefineUpdate) && options.preventDefineUpdate.includes(param);
112
- if ((0, import_utils.isUndefined)(prop) || hasOnlyUpdateFalsy || isInPreventUpdate || isInPreventDefineUpdate || options.preventDefineUpdate === true || options.preventDefineUpdate === param || options.preventContentUpdate && param === "content" || (options.preventStateUpdate && param) === "state" || (0, import_methods.isMethod)(param) || (0, import_utils.isObject)(import_mixins.registry[param]) || (0, import_utils2.isVariant)(param))
115
+ const hasCollection = element.$collection || element.$stateCollection || element.$propsCollection;
116
+ if ((0, import_utils.isUndefined)(prop) || hasOnlyUpdateFalsy || isInPreventUpdate || isInPreventDefineUpdate || options.preventDefineUpdate === true || options.preventDefineUpdate === param || options.preventContentUpdate && param === "content" && !hasCollection || (options.preventStateUpdate && param) === "state" || (0, import_methods.isMethod)(param) || (0, import_utils.isObject)(import_mixins.registry[param]) || (0, import_utils2.isVariant)(param))
113
117
  continue;
114
118
  if (options.preventStateUpdate === "once")
115
119
  options.preventStateUpdate = false;
@@ -205,13 +209,13 @@ const inheritStateUpdates = (element, options) => {
205
209
  const keyInParentState = (0, import_state.findInheritedState)(element, element.parent);
206
210
  if (!keyInParentState || options.preventInheritedStateUpdate)
207
211
  return;
208
- if (!options.preventInitStateUpdateListener) {
212
+ if (!options.preventInitStateUpdateListener && !options.preventListeners) {
209
213
  const initStateReturns = (0, import_event.triggerEventOnUpdate)("initStateUpdate", keyInParentState, element, options);
210
214
  if (initStateReturns === false)
211
215
  return element;
212
216
  }
213
217
  const newState = createStateUpdate(element, parent, options);
214
- if (!options.preventStateUpdateListener) {
218
+ if (!options.preventStateUpdateListener && !options.preventListeners) {
215
219
  (0, import_event.triggerEventOnUpdate)("stateUpdate", newState.parse(), element, options);
216
220
  }
217
221
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/element",
3
- "version": "2.5.56",
3
+ "version": "2.5.57",
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": "a832fd0b6d8c39f16e6c7b2b61ab6c3dccd1f539",
34
+ "gitHead": "f479a1805e3de4f53d9b3392bfe93b9d735c948c",
35
35
  "devDependencies": {
36
36
  "@babel/core": "^7.12.0"
37
37
  }
package/set.js CHANGED
@@ -13,7 +13,8 @@ const set = function (params, options = {}, el) {
13
13
  const __contentRef = content && content.__ref
14
14
  const lazyLoad = element.props && element.props.lazyLoad
15
15
 
16
- if (options.preventContentUpdate === true) return
16
+ const hasCollection = element.$collection || element.$stateCollection || element.$propsCollection
17
+ if (options.preventContentUpdate === true && !hasCollection) return
17
18
 
18
19
  if (ref.__noCollectionDifference || (__contentRef && __contentRef.__cached && deepContains(params, content))) {
19
20
  return content.update()
package/update.js CHANGED
@@ -44,7 +44,7 @@ const update = function (params = {}, options = UPDATE_DEFAULT_OPTIONS) {
44
44
  const { parent, node, key } = element
45
45
  const { excludes, preventInheritAtCurrentState } = options
46
46
 
47
- triggerEventOnUpdate('startUpdate', params, element, options)
47
+ if (!options.preventListeners) triggerEventOnUpdate('startUpdate', params, element, options)
48
48
 
49
49
  if (preventInheritAtCurrentState && preventInheritAtCurrentState.__element === element) return
50
50
  if (!excludes) merge(options, UPDATE_DEFAULT_OPTIONS)
@@ -72,16 +72,17 @@ const update = function (params = {}, options = UPDATE_DEFAULT_OPTIONS) {
72
72
  if (props) updateProps(props, element, parent)
73
73
  }
74
74
 
75
- if (!options.preventInitUpdateListener) {
75
+ if (!options.preventInitUpdateListener && !options.preventListeners) {
76
76
  const initUpdateReturns = triggerEventOnUpdate('initUpdate', params, element, options)
77
77
  if (initUpdateReturns === false) return element
78
78
  }
79
79
 
80
80
  const overwriteChanges = overwriteDeep(element, params, METHODS_EXL)
81
81
  const execChanges = throughUpdatedExec(element, { ignore: UPDATE_DEFAULT_OPTIONS })
82
+ if (element.key === 'Navigation') debugger
82
83
  const definedChanges = throughUpdatedDefine(element)
83
84
 
84
- if (!options.isForced) {
85
+ if (!options.isForced && !options.preventListeners) {
85
86
  triggerEventOn('beforeClassAssign', element, options)
86
87
  }
87
88
 
@@ -102,6 +103,8 @@ const update = function (params = {}, options = UPDATE_DEFAULT_OPTIONS) {
102
103
  const isInPreventUpdate = isArray(options.preventUpdate) && options.preventUpdate.includes(param)
103
104
  const isInPreventDefineUpdate = isArray(options.preventDefineUpdate) && options.preventDefineUpdate.includes(param)
104
105
 
106
+ const hasCollection = element.$collection || element.$stateCollection || element.$propsCollection
107
+
105
108
  if (
106
109
  isUndefined(prop) ||
107
110
  hasOnlyUpdateFalsy ||
@@ -109,7 +112,7 @@ const update = function (params = {}, options = UPDATE_DEFAULT_OPTIONS) {
109
112
  isInPreventDefineUpdate ||
110
113
  options.preventDefineUpdate === true ||
111
114
  options.preventDefineUpdate === param ||
112
- (options.preventContentUpdate && param === 'content') ||
115
+ (options.preventContentUpdate && param === 'content' && !hasCollection) ||
113
116
  (options.preventStateUpdate && param) === 'state' ||
114
117
  isMethod(param) || isObject(registry[param]) || isVariant(param)
115
118
  ) continue
@@ -244,7 +247,7 @@ const inheritStateUpdates = (element, options) => {
244
247
  if (!keyInParentState || options.preventInheritedStateUpdate) return
245
248
 
246
249
  // Trigger on.initStateUpdate event
247
- if (!options.preventInitStateUpdateListener) {
250
+ if (!options.preventInitStateUpdateListener && !options.preventListeners) {
248
251
  const initStateReturns = triggerEventOnUpdate('initStateUpdate', keyInParentState, element, options)
249
252
  if (initStateReturns === false) return element
250
253
  }
@@ -253,7 +256,7 @@ const inheritStateUpdates = (element, options) => {
253
256
  const newState = createStateUpdate(element, parent, options)
254
257
 
255
258
  // Trigger on.stateUpdate event
256
- if (!options.preventStateUpdateListener) {
259
+ if (!options.preventStateUpdateListener && !options.preventListeners) {
257
260
  triggerEventOnUpdate('stateUpdate', newState.parse(), element, options)
258
261
  }
259
262
  }