@domql/element 2.5.121 → 2.5.122

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.
@@ -53,25 +53,25 @@ const UPDATE_DEFAULT_OPTIONS = {
53
53
  calleeElement: false,
54
54
  excludes: import_utils2.METHODS_EXL
55
55
  };
56
- const update = function(params = {}, 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"]);
56
+ const update = function(params = {}, opts) {
57
+ const calleeElementCache = opts == null ? void 0 : opts.calleeElement;
58
+ const options = (0, import_utils2.deepClone)((0, import_utils.isObject)(opts) ? (0, import_utils2.deepMerge)(opts, UPDATE_DEFAULT_OPTIONS) : UPDATE_DEFAULT_OPTIONS, ["calleeElement"]);
59
59
  options.calleeElement = calleeElementCache;
60
60
  const element = this;
61
61
  const { parent, node, key } = element;
62
62
  const { excludes, preventInheritAtCurrentState } = options;
63
- if (!options.preventListeners)
64
- (0, import_event.triggerEventOnUpdate)("startUpdate", params, element, options);
65
- if (preventInheritAtCurrentState && preventInheritAtCurrentState.__element === element)
66
- return;
67
- if (!excludes)
68
- (0, import_utils.merge)(options, UPDATE_DEFAULT_OPTIONS);
69
63
  let ref = element.__ref;
70
64
  if (!ref)
71
65
  ref = element.__ref = {};
72
66
  const [snapshotOnCallee, calleeElement, snapshotHasUpdated] = captureSnapshot(element, options);
73
67
  if (snapshotHasUpdated)
74
68
  return;
69
+ if (!options.preventListeners)
70
+ (0, import_event.triggerEventOnUpdate)("startUpdate", params, element, options);
71
+ if (preventInheritAtCurrentState && preventInheritAtCurrentState.__element === element)
72
+ return;
73
+ if (!excludes)
74
+ (0, import_utils.merge)(options, UPDATE_DEFAULT_OPTIONS);
75
75
  if ((0, import_utils.isString)(params) || (0, import_utils.isNumber)(params)) {
76
76
  params = { text: params };
77
77
  }
@@ -129,6 +129,9 @@ const update = function(params = {}, opts = UPDATE_DEFAULT_OPTIONS) {
129
129
  }
130
130
  for (const param in element) {
131
131
  const prop = element[param];
132
+ if (element.Iframe && element.Overlay && element.ComponentFrameCanvas && param === "Iframe") {
133
+ console.log("isframe");
134
+ }
132
135
  if (!Object.hasOwnProperty.call(element, param))
133
136
  continue;
134
137
  const hasOnlyUpdateFalsy = onlyUpdate && (onlyUpdate !== param || !element.lookup(onlyUpdate));
@@ -166,7 +169,7 @@ const captureSnapshot = (element, options) => {
166
169
  ref.__currentSnapshot = createdStanpshot;
167
170
  return [createdStanpshot, element];
168
171
  }
169
- const snapshotOnCallee = ref.__currentSnapshot;
172
+ const snapshotOnCallee = calleeElement.__ref.__currentSnapshot;
170
173
  if (currentSnapshot < snapshotOnCallee) {
171
174
  return [snapshotOnCallee, calleeElement, true];
172
175
  }
@@ -261,7 +264,7 @@ const createStateUpdate = (element, parent, options) => {
261
264
  for (const child in __stateChildren) {
262
265
  if (newState[child])
263
266
  newState.__children[child] = __stateChildren[child];
264
- __stateChildren[child].parent = newState;
267
+ Object.getPrototypeOf(__stateChildren[child]).parent = newState;
265
268
  }
266
269
  return newState;
267
270
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/element",
3
- "version": "2.5.121",
3
+ "version": "2.5.122",
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": "5130bdaa1358d22df75746616dd3387b8a56b55b",
34
+ "gitHead": "2f048372ece4d808cfaca8e43491611dafe3ad5f",
35
35
  "devDependencies": {
36
36
  "@babel/core": "^7.12.0"
37
37
  }
package/update.js CHANGED
@@ -39,25 +39,24 @@ const UPDATE_DEFAULT_OPTIONS = {
39
39
  excludes: METHODS_EXL
40
40
  }
41
41
 
42
- const update = function (params = {}, opts = UPDATE_DEFAULT_OPTIONS) {
43
- const calleeElementCache = opts.calleeElement
44
- const options = deepClone(deepMerge(opts, UPDATE_DEFAULT_OPTIONS), ['calleeElement'])
42
+ const update = function (params = {}, opts) {
43
+ const calleeElementCache = opts?.calleeElement
44
+ const options = deepClone(isObject(opts) ? deepMerge(opts, UPDATE_DEFAULT_OPTIONS) : UPDATE_DEFAULT_OPTIONS, ['calleeElement'])
45
45
  options.calleeElement = calleeElementCache
46
46
  const element = this
47
47
  const { parent, node, key } = element
48
48
  const { excludes, preventInheritAtCurrentState } = options
49
49
 
50
- if (!options.preventListeners) triggerEventOnUpdate('startUpdate', params, element, options)
51
-
52
- if (preventInheritAtCurrentState && preventInheritAtCurrentState.__element === element) return
53
- if (!excludes) merge(options, UPDATE_DEFAULT_OPTIONS)
54
-
55
50
  let ref = element.__ref
56
51
  if (!ref) ref = element.__ref = {}
57
-
58
52
  const [snapshotOnCallee, calleeElement, snapshotHasUpdated] = captureSnapshot(element, options)
59
53
  if (snapshotHasUpdated) return
60
54
 
55
+ if (!options.preventListeners) triggerEventOnUpdate('startUpdate', params, element, options)
56
+
57
+ if (preventInheritAtCurrentState && preventInheritAtCurrentState.__element === element) return
58
+ if (!excludes) merge(options, UPDATE_DEFAULT_OPTIONS)
59
+
61
60
  if (isString(params) || isNumber(params)) {
62
61
  params = { text: params }
63
62
  }
@@ -113,6 +112,10 @@ const update = function (params = {}, opts = UPDATE_DEFAULT_OPTIONS) {
113
112
  for (const param in element) {
114
113
  const prop = element[param]
115
114
 
115
+ if (element.Iframe && element.Overlay && element.ComponentFrameCanvas && param === 'Iframe') {
116
+ console.log('isframe')
117
+ }
118
+
116
119
  if (!Object.hasOwnProperty.call(element, param)) continue
117
120
 
118
121
  const hasOnlyUpdateFalsy = onlyUpdate && (onlyUpdate !== param || !element.lookup(onlyUpdate))
@@ -166,7 +169,8 @@ const captureSnapshot = (element, options) => {
166
169
  return [createdStanpshot, element]
167
170
  }
168
171
 
169
- const snapshotOnCallee = ref.__currentSnapshot
172
+ const snapshotOnCallee = calleeElement.__ref.__currentSnapshot
173
+
170
174
  if (currentSnapshot < snapshotOnCallee) {
171
175
  return [snapshotOnCallee, calleeElement, true]
172
176
  }
@@ -297,7 +301,8 @@ const createStateUpdate = (element, parent, options) => {
297
301
  for (const child in __stateChildren) {
298
302
  // check this for inherited states
299
303
  if (newState[child]) newState.__children[child] = __stateChildren[child]
300
- __stateChildren[child].parent = newState
304
+ // __stateChildren[child].parent = newState
305
+ Object.getPrototypeOf(__stateChildren[child]).parent = newState
301
306
  }
302
307
  return newState
303
308
  }