@domql/element 2.5.65 → 2.5.66

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.
@@ -105,20 +105,39 @@ const update = function(params = {}, options = UPDATE_DEFAULT_OPTIONS) {
105
105
  if (!node) {
106
106
  return;
107
107
  }
108
+ const {
109
+ onlyUpdate,
110
+ preventUpdate,
111
+ preventDefineUpdate,
112
+ preventContentUpdate,
113
+ preventStateUpdate,
114
+ preventRecursive,
115
+ preventUpdateListener,
116
+ preventUpdateAfter,
117
+ preventUpdateAfterCount
118
+ } = options;
119
+ if (preventUpdateAfter) {
120
+ if ((0, import_utils.isNumber)(preventUpdateAfterCount) && preventUpdateAfter <= preventUpdateAfterCount)
121
+ return;
122
+ else if (options.preventUpdateAfterCount === void 0)
123
+ options.preventUpdateAfterCount = 1;
124
+ else
125
+ options.preventUpdateAfterCount++;
126
+ }
108
127
  for (const param in element) {
109
128
  const prop = element[param];
110
- const hasOnlyUpdateFalsy = options.onlyUpdate && (options.onlyUpdate !== param || !element.lookup(options.onlyUpdate));
111
- const isInPreventUpdate = (0, import_utils.isArray)(options.preventUpdate) && options.preventUpdate.includes(param);
112
- const isInPreventDefineUpdate = (0, import_utils.isArray)(options.preventDefineUpdate) && options.preventDefineUpdate.includes(param);
129
+ const hasOnlyUpdateFalsy = onlyUpdate && (onlyUpdate !== param || !element.lookup(onlyUpdate));
130
+ const isInPreventUpdate = (0, import_utils.isArray)(preventUpdate) && preventUpdate.includes(param);
131
+ const isInPreventDefineUpdate = (0, import_utils.isArray)(preventDefineUpdate) && preventDefineUpdate.includes(param);
113
132
  const hasCollection = element.$collection || element.$stateCollection || element.$propsCollection;
114
- 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))
133
+ if ((0, import_utils.isUndefined)(prop) || hasOnlyUpdateFalsy || isInPreventUpdate || isInPreventDefineUpdate || preventDefineUpdate === true || preventDefineUpdate === param || preventContentUpdate && param === "content" && !hasCollection || (preventStateUpdate && param) === "state" || (0, import_methods.isMethod)(param) || (0, import_utils.isObject)(import_mixins.registry[param]) || (0, import_utils2.isVariant)(param))
115
134
  continue;
116
- if (options.preventStateUpdate === "once")
135
+ if (preventStateUpdate === "once")
117
136
  options.preventStateUpdate = false;
118
137
  const isElement = (0, import_applyParam.applyParam)(param, element, options);
119
138
  if (isElement) {
120
139
  const { hasDefine, hasContextDefine } = isElement;
121
- const canUpdate = (0, import_utils.isObject)(prop) && !hasDefine && !hasContextDefine && !options.preventRecursive;
140
+ const canUpdate = (0, import_utils.isObject)(prop) && !hasDefine && !hasContextDefine && !preventRecursive;
122
141
  if (!canUpdate)
123
142
  continue;
124
143
  const lazyLoad = element.props.lazyLoad || options.lazyLoad;
@@ -130,7 +149,7 @@ const update = function(params = {}, options = UPDATE_DEFAULT_OPTIONS) {
130
149
  lazyLoad ? import_utils.window.requestAnimationFrame(() => childUpdateCall()) : childUpdateCall();
131
150
  }
132
151
  }
133
- if (!options.preventUpdateListener)
152
+ if (!preventUpdateListener)
134
153
  (0, import_event.triggerEventOn)("update", element, options);
135
154
  };
136
155
  const captureSnapshot = (element, options) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/element",
3
- "version": "2.5.65",
3
+ "version": "2.5.66",
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": "473e5569815c8e062b8e584549889557330c249a",
34
+ "gitHead": "5cb5b9bd779042cc3cfe3d912bdc48fb8293ea0b",
35
35
  "devDependencies": {
36
36
  "@babel/core": "^7.12.0"
37
37
  }
package/update.js CHANGED
@@ -97,11 +97,23 @@ const update = function (params = {}, options = UPDATE_DEFAULT_OPTIONS) {
97
97
  return
98
98
  }
99
99
 
100
+ const {
101
+ onlyUpdate, preventUpdate, preventDefineUpdate, preventContentUpdate, preventStateUpdate,
102
+ preventRecursive, preventUpdateListener, preventUpdateAfter, preventUpdateAfterCount
103
+ } = options
104
+
105
+ if (preventUpdateAfter) {
106
+ if (isNumber(preventUpdateAfterCount) && preventUpdateAfter <= preventUpdateAfterCount) return
107
+ else if (options.preventUpdateAfterCount === undefined) options.preventUpdateAfterCount = 1
108
+ else options.preventUpdateAfterCount++
109
+ }
110
+
100
111
  for (const param in element) {
101
112
  const prop = element[param]
102
- const hasOnlyUpdateFalsy = options.onlyUpdate && (options.onlyUpdate !== param || !element.lookup(options.onlyUpdate))
103
- const isInPreventUpdate = isArray(options.preventUpdate) && options.preventUpdate.includes(param)
104
- const isInPreventDefineUpdate = isArray(options.preventDefineUpdate) && options.preventDefineUpdate.includes(param)
113
+
114
+ const hasOnlyUpdateFalsy = onlyUpdate && (onlyUpdate !== param || !element.lookup(onlyUpdate))
115
+ const isInPreventUpdate = isArray(preventUpdate) && preventUpdate.includes(param)
116
+ const isInPreventDefineUpdate = isArray(preventDefineUpdate) && preventDefineUpdate.includes(param)
105
117
 
106
118
  const hasCollection = element.$collection || element.$stateCollection || element.$propsCollection
107
119
 
@@ -110,18 +122,18 @@ const update = function (params = {}, options = UPDATE_DEFAULT_OPTIONS) {
110
122
  hasOnlyUpdateFalsy ||
111
123
  isInPreventUpdate ||
112
124
  isInPreventDefineUpdate ||
113
- options.preventDefineUpdate === true ||
114
- options.preventDefineUpdate === param ||
115
- (options.preventContentUpdate && param === 'content' && !hasCollection) ||
116
- (options.preventStateUpdate && param) === 'state' ||
125
+ preventDefineUpdate === true ||
126
+ preventDefineUpdate === param ||
127
+ (preventContentUpdate && param === 'content' && !hasCollection) ||
128
+ (preventStateUpdate && param) === 'state' ||
117
129
  isMethod(param) || isObject(registry[param]) || isVariant(param)
118
130
  ) continue
119
- if (options.preventStateUpdate === 'once') options.preventStateUpdate = false
131
+ if (preventStateUpdate === 'once') options.preventStateUpdate = false
120
132
 
121
133
  const isElement = applyParam(param, element, options)
122
134
  if (isElement) {
123
135
  const { hasDefine, hasContextDefine } = isElement
124
- const canUpdate = isObject(prop) && !hasDefine && !hasContextDefine && !options.preventRecursive
136
+ const canUpdate = isObject(prop) && !hasDefine && !hasContextDefine && !preventRecursive
125
137
  if (!canUpdate) continue
126
138
 
127
139
  const lazyLoad = element.props.lazyLoad || options.lazyLoad
@@ -136,7 +148,7 @@ const update = function (params = {}, options = UPDATE_DEFAULT_OPTIONS) {
136
148
  }
137
149
  }
138
150
 
139
- if (!options.preventUpdateListener) triggerEventOn('update', element, options)
151
+ if (!preventUpdateListener) triggerEventOn('update', element, options)
140
152
  }
141
153
 
142
154
  const captureSnapshot = (element, options) => {