@domql/element 2.5.130 → 2.5.132

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
@@ -228,7 +228,15 @@ const renderElement = (element, parent, options, attachOptions) => {
228
228
  createNode(element, options)
229
229
  ref.__uniqId = Math.random()
230
230
  } catch (e) {
231
- if (ENV === 'test' || ENV === 'development') console.warn(element, e)
231
+ if (ENV === 'test' || ENV === 'development') {
232
+ const path = ref.__path
233
+ if (path.includes('ComponentsGrid')) path.splice(0, path.indexOf('ComponentsGrid') + 2)
234
+ if (path.includes('demoComponent')) path.splice(0, path.indexOf('demoComponent') + 1)
235
+ const isDemoComponent = element.lookup(el => el.state.key)?.state?.key
236
+ console.warn('Error happened in:', isDemoComponent ? isDemoComponent + ' ' : '' + path.join('.'))
237
+ console.warn(element)
238
+ console.error(e)
239
+ }
232
240
  }
233
241
 
234
242
  if (!ref.__if) {
@@ -169,6 +169,7 @@ const addElementIntoParentChildren = (element, parent) => {
169
169
  };
170
170
  const visitedElements = /* @__PURE__ */ new WeakMap();
171
171
  const renderElement = (element, parent, options, attachOptions) => {
172
+ var _a, _b;
172
173
  if (visitedElements.has(element)) {
173
174
  if (ENV === "test" || ENV === "development")
174
175
  console.warn("Cyclic rendering detected:", element.__ref.__path);
@@ -182,8 +183,17 @@ const renderElement = (element, parent, options, attachOptions) => {
182
183
  (0, import_node.default)(element, options);
183
184
  ref.__uniqId = Math.random();
184
185
  } catch (e) {
185
- if (ENV === "test" || ENV === "development")
186
- console.warn(element, e);
186
+ if (ENV === "test" || ENV === "development") {
187
+ const path = ref.__path;
188
+ if (path.includes("ComponentsGrid"))
189
+ path.splice(0, path.indexOf("ComponentsGrid") + 2);
190
+ if (path.includes("demoComponent"))
191
+ path.splice(0, path.indexOf("demoComponent") + 1);
192
+ const isDemoComponent = (_b = (_a = element.lookup((el) => el.state.key)) == null ? void 0 : _a.state) == null ? void 0 : _b.key;
193
+ console.warn("Error happened in:", isDemoComponent ? isDemoComponent + " " : "" + path.join("."));
194
+ console.warn(element);
195
+ console.error(e);
196
+ }
187
197
  }
188
198
  if (!ref.__if) {
189
199
  parent[key || element.key] = element;
@@ -109,7 +109,6 @@ const update = function(params = {}, opts) {
109
109
  return;
110
110
  }
111
111
  const {
112
- onlyUpdate,
113
112
  preventUpdate,
114
113
  preventDefineUpdate,
115
114
  preventContentUpdate,
@@ -134,11 +133,10 @@ const update = function(params = {}, opts) {
134
133
  }
135
134
  if (!Object.hasOwnProperty.call(element, param))
136
135
  continue;
137
- const hasOnlyUpdateFalsy = onlyUpdate && (onlyUpdate !== param || !element.lookup(onlyUpdate));
138
136
  const isInPreventUpdate = (0, import_utils.isArray)(preventUpdate) && preventUpdate.includes(param);
139
137
  const isInPreventDefineUpdate = (0, import_utils.isArray)(preventDefineUpdate) && preventDefineUpdate.includes(param);
140
138
  const hasCollection = element.$collection || element.$stateCollection || element.$propsCollection;
141
- 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_utils.isVariant)(param))
139
+ if ((0, import_utils.isUndefined)(prop) || 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_utils.isVariant)(param))
142
140
  continue;
143
141
  if (preventStateUpdate === "once")
144
142
  options.preventStateUpdate = false;
@@ -26,6 +26,7 @@ var import_mixins = require("../mixins");
26
26
  const applyParam = (param, element, options) => {
27
27
  const { node, context, __ref: ref } = element;
28
28
  const prop = element[param];
29
+ const { onlyUpdate } = options;
29
30
  const DOMQLProperty = import_mixins.registry[param];
30
31
  const DOMQLPropertyFromContext = context && context.registry && context.registry[param];
31
32
  const isGlobalTransformer = DOMQLPropertyFromContext || DOMQLProperty;
@@ -33,7 +34,8 @@ const applyParam = (param, element, options) => {
33
34
  const hasContextDefine = context && context.define && context.define[param];
34
35
  if (!ref.__if)
35
36
  return;
36
- if (isGlobalTransformer && !hasContextDefine) {
37
+ const hasOnlyUpdate = onlyUpdate ? onlyUpdate === param || element.lookup(onlyUpdate) : true;
38
+ if (isGlobalTransformer && !hasContextDefine && hasOnlyUpdate) {
37
39
  if ((0, import_utils.isFunction)(isGlobalTransformer)) {
38
40
  isGlobalTransformer(prop, element, node, options);
39
41
  return;
package/extend.js CHANGED
@@ -37,6 +37,9 @@ export const applyExtend = (element, parent, options = {}) => {
37
37
  if (!options.ignoreChildExtend && !(props && props.ignoreChildExtend)) {
38
38
  childExtendStack = getExtendStack(parent.childExtend, context)
39
39
 
40
+ // if (!options.ignoreChildExtend && !(props && exec(props, element).ignoreChildExtend)) {
41
+ // const ignoreChildExtendRecursive = props && exec(props, element).ignoreChildExtendRecursive
42
+
40
43
  const ignoreChildExtendRecursive = props && props.ignoreChildExtendRecursive
41
44
  if (parent.childExtendRecursive && !ignoreChildExtendRecursive) {
42
45
  const canExtendRecursive = element.key !== '__text'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/element",
3
- "version": "2.5.130",
3
+ "version": "2.5.132",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "index.js",
@@ -32,7 +32,7 @@
32
32
  "@domql/state": "latest",
33
33
  "@domql/utils": "latest"
34
34
  },
35
- "gitHead": "88815c621b7aeb9458c779643934c0d2e5305cd2",
35
+ "gitHead": "d4f45522f7132c6d8413f7babae9c1780eb70300",
36
36
  "devDependencies": {
37
37
  "@babel/core": "^7.12.0"
38
38
  }
package/update.js CHANGED
@@ -101,7 +101,7 @@ const update = function (params = {}, opts) {
101
101
  }
102
102
 
103
103
  const {
104
- onlyUpdate, preventUpdate, preventDefineUpdate, preventContentUpdate, preventStateUpdate,
104
+ preventUpdate, preventDefineUpdate, preventContentUpdate, preventStateUpdate,
105
105
  preventRecursive, preventUpdateListener, preventUpdateAfter, preventUpdateAfterCount
106
106
  } = options
107
107
 
@@ -120,7 +120,6 @@ const update = function (params = {}, opts) {
120
120
 
121
121
  if (!Object.hasOwnProperty.call(element, param)) continue
122
122
 
123
- const hasOnlyUpdateFalsy = onlyUpdate && (onlyUpdate !== param || !element.lookup(onlyUpdate))
124
123
  const isInPreventUpdate = isArray(preventUpdate) && preventUpdate.includes(param)
125
124
  const isInPreventDefineUpdate = isArray(preventDefineUpdate) && preventDefineUpdate.includes(param)
126
125
 
@@ -128,7 +127,6 @@ const update = function (params = {}, opts) {
128
127
 
129
128
  if (
130
129
  isUndefined(prop) ||
131
- hasOnlyUpdateFalsy ||
132
130
  isInPreventUpdate ||
133
131
  isInPreventDefineUpdate ||
134
132
  preventDefineUpdate === true ||
@@ -137,6 +135,7 @@ const update = function (params = {}, opts) {
137
135
  (preventStateUpdate && param) === 'state' ||
138
136
  isMethod(param) || isObject(registry[param]) || isVariant(param)
139
137
  ) continue
138
+
140
139
  if (preventStateUpdate === 'once') options.preventStateUpdate = false
141
140
 
142
141
  const isElement = applyParam(param, element, options)
@@ -7,6 +7,8 @@ export const applyParam = (param, element, options) => {
7
7
  const { node, context, __ref: ref } = element
8
8
  const prop = element[param]
9
9
 
10
+ const { onlyUpdate } = options
11
+
10
12
  const DOMQLProperty = registry[param]
11
13
  const DOMQLPropertyFromContext = context && context.registry && context.registry[param]
12
14
  const isGlobalTransformer = DOMQLPropertyFromContext || DOMQLProperty
@@ -16,7 +18,9 @@ export const applyParam = (param, element, options) => {
16
18
 
17
19
  if (!ref.__if) return
18
20
 
19
- if (isGlobalTransformer && !hasContextDefine) {
21
+ const hasOnlyUpdate = onlyUpdate ? (onlyUpdate === param || element.lookup(onlyUpdate)) : true
22
+
23
+ if (isGlobalTransformer && !hasContextDefine && hasOnlyUpdate) {
20
24
  if (isFunction(isGlobalTransformer)) {
21
25
  isGlobalTransformer(prop, element, node, options)
22
26
  return