@domql/element 2.5.200 → 2.5.205

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.
Files changed (66) hide show
  1. package/create.js +5 -5
  2. package/dist/cjs/create.js +88 -46
  3. package/dist/cjs/define.js +2 -1
  4. package/dist/cjs/extend.js +8 -4
  5. package/dist/cjs/index.js +3 -3
  6. package/dist/cjs/iterate.js +18 -9
  7. package/dist/cjs/methods/index.js +69 -36
  8. package/dist/cjs/methods/set.js +2 -1
  9. package/dist/cjs/methods/v2.js +12 -6
  10. package/dist/cjs/mixins/attr.js +8 -4
  11. package/dist/cjs/mixins/classList.js +16 -8
  12. package/dist/cjs/mixins/content.js +16 -9
  13. package/dist/cjs/mixins/data.js +4 -2
  14. package/dist/cjs/mixins/html.js +4 -2
  15. package/dist/cjs/mixins/scope.js +2 -1
  16. package/dist/cjs/mixins/state.js +4 -2
  17. package/dist/cjs/mixins/style.js +4 -2
  18. package/dist/cjs/mixins/text.js +6 -3
  19. package/dist/cjs/node.js +13 -7
  20. package/dist/cjs/props/create.js +12 -6
  21. package/dist/cjs/props/inherit.js +4 -2
  22. package/dist/cjs/props/update.js +6 -3
  23. package/dist/cjs/set.js +16 -9
  24. package/dist/cjs/update.js +53 -29
  25. package/dist/cjs/utils/applyParam.js +4 -3
  26. package/dist/cjs/utils/component.js +6 -3
  27. package/dist/cjs/utils/extendUtils.js +19 -10
  28. package/dist/cjs/utils/object.js +16 -8
  29. package/dist/cjs/utils/onlyResolveExtends.js +26 -13
  30. package/dist/cjs/utils/propEvents.js +4 -2
  31. package/dist/esm/create.js +88 -46
  32. package/dist/esm/define.js +2 -1
  33. package/dist/esm/extend.js +8 -4
  34. package/dist/esm/iterate.js +18 -9
  35. package/dist/esm/methods/index.js +69 -36
  36. package/dist/esm/methods/set.js +2 -1
  37. package/dist/esm/methods/v2.js +12 -6
  38. package/dist/esm/mixins/attr.js +8 -4
  39. package/dist/esm/mixins/classList.js +16 -8
  40. package/dist/esm/mixins/content.js +16 -9
  41. package/dist/esm/mixins/data.js +4 -2
  42. package/dist/esm/mixins/html.js +4 -2
  43. package/dist/esm/mixins/scope.js +2 -1
  44. package/dist/esm/mixins/state.js +4 -2
  45. package/dist/esm/mixins/style.js +4 -2
  46. package/dist/esm/mixins/text.js +6 -3
  47. package/dist/esm/node.js +13 -7
  48. package/dist/esm/props/create.js +12 -6
  49. package/dist/esm/props/inherit.js +4 -2
  50. package/dist/esm/props/update.js +6 -3
  51. package/dist/esm/set.js +16 -9
  52. package/dist/esm/update.js +53 -29
  53. package/dist/esm/utils/applyParam.js +4 -3
  54. package/dist/esm/utils/component.js +6 -3
  55. package/dist/esm/utils/extendUtils.js +19 -10
  56. package/dist/esm/utils/object.js +16 -8
  57. package/dist/esm/utils/onlyResolveExtends.js +26 -13
  58. package/dist/esm/utils/propEvents.js +4 -2
  59. package/methods/index.js +3 -3
  60. package/mixins/content.js +2 -2
  61. package/node.js +1 -1
  62. package/package.json +8 -8
  63. package/set.js +3 -3
  64. package/update.js +6 -6
  65. package/utils/applyParam.js +2 -2
  66. package/utils/extendUtils.js +1 -1
@@ -53,12 +53,15 @@ function spotByPath(path) {
53
53
  const element = this;
54
54
  const arr = [].concat(path);
55
55
  let active = import_tree.TREE[arr[0]];
56
- if (!arr || !arr.length) return console.log(arr, "on", element.key, "is undefined");
56
+ if (!arr || !arr.length)
57
+ return console.log(arr, "on", element.key, "is undefined");
57
58
  while (active.key === arr[0]) {
58
59
  arr.shift();
59
- if (!arr.length) break;
60
+ if (!arr.length)
61
+ break;
60
62
  active = active[arr[0]];
61
- if (!active) return;
63
+ if (!active)
64
+ return;
62
65
  }
63
66
  return active;
64
67
  }
@@ -66,15 +69,21 @@ function lookup(param) {
66
69
  const el = this;
67
70
  let { parent } = el;
68
71
  if ((0, import_utils.isFunction)(param)) {
69
- if (parent.state && param(parent, parent.state, parent.context)) return parent;
70
- else if (parent.parent) return parent.lookup(param);
71
- else return;
72
+ if (parent.state && param(parent, parent.state, parent.context))
73
+ return parent;
74
+ else if (parent.parent)
75
+ return parent.lookup(param);
76
+ else
77
+ return;
72
78
  }
73
- if (el[param]) return el[param];
79
+ if (el[param])
80
+ return el[param];
74
81
  while (parent.param !== param) {
75
- if (parent[param]) return parent[param];
82
+ if (parent[param])
83
+ return parent[param];
76
84
  parent = parent.parent;
77
- if (!parent) return;
85
+ if (!parent)
86
+ return;
78
87
  }
79
88
  return parent;
80
89
  }
@@ -86,7 +95,8 @@ function lookdown(param) {
86
95
  for (let i = 0; i < children.length; i++) {
87
96
  const v = children[i];
88
97
  const childElem = el[v];
89
- if (v === param) return childElem;
98
+ if (v === param)
99
+ return childElem;
90
100
  else if ((0, import_utils.isFunction)(param)) {
91
101
  const exec = param(childElem, childElem.state, childElem.context);
92
102
  if (childElem.state && exec) {
@@ -94,7 +104,8 @@ function lookdown(param) {
94
104
  }
95
105
  }
96
106
  const lookdown2 = (_a = childElem == null ? void 0 : childElem.lookdown) == null ? void 0 : _a.call(childElem, param);
97
- if (lookdown2) return lookdown2;
107
+ if (lookdown2)
108
+ return lookdown2;
98
109
  }
99
110
  }
100
111
  function lookdownAll(param, results = []) {
@@ -105,10 +116,12 @@ function lookdownAll(param, results = []) {
105
116
  for (let i = 0; i < children.length; i++) {
106
117
  const v = children[i];
107
118
  const childElem = el[v];
108
- if (v === param) results.push(childElem);
119
+ if (v === param)
120
+ results.push(childElem);
109
121
  else if ((0, import_utils.isFunction)(param)) {
110
122
  const exec = param(childElem, childElem.state, childElem.context);
111
- if (childElem.state && exec) results.push(childElem);
123
+ if (childElem.state && exec)
124
+ results.push(childElem);
112
125
  }
113
126
  (_a = childElem == null ? void 0 : childElem.lookdownAll) == null ? void 0 : _a.call(childElem, param, results);
114
127
  }
@@ -117,26 +130,32 @@ function lookdownAll(param, results = []) {
117
130
  function setNodeStyles(params = {}) {
118
131
  var _a;
119
132
  const el = this;
120
- if (!((_a = el.node) == null ? void 0 : _a.style)) return;
133
+ if (!((_a = el.node) == null ? void 0 : _a.style))
134
+ return;
121
135
  for (const param in params) {
122
136
  const value = params[param];
123
137
  const childElem = el[param];
124
- if ((0, import_utils.isObject)(value) && childElem) setNodeStyles.call(childElem, value);
125
- else el.node.style[param] = value;
138
+ if ((0, import_utils.isObject)(value) && childElem)
139
+ setNodeStyles.call(childElem, value);
140
+ else
141
+ el.node.style[param] = value;
126
142
  }
127
143
  return el;
128
144
  }
129
145
  function remove(opts) {
130
146
  const element = this;
131
147
  const beforeRemoveReturns = (0, import_event.triggerEventOn)("beforeRemove", element, opts);
132
- if (beforeRemoveReturns === false) return element;
133
- if ((0, import_utils.isFunction)(element.node.remove)) element.node.remove();
148
+ if (beforeRemoveReturns === false)
149
+ return element;
150
+ if ((0, import_utils.isFunction)(element.node.remove))
151
+ element.node.remove();
134
152
  else if (!(0, import_utils.isProduction)()) {
135
153
  console.warn("This item cant be removed");
136
154
  element.log();
137
155
  }
138
156
  delete element.parent[element.key];
139
- if (element.parent.__ref) element.parent.__ref.__children = (0, import_utils.removeValueFromArray)(element.parent.__ref.__children, element.key);
157
+ if (element.parent.__ref)
158
+ element.parent.__ref.__children = (0, import_utils.removeValueFromArray)(element.parent.__ref.__children, element.key);
140
159
  (0, import_event.triggerEventOn)("remove", element, opts);
141
160
  }
142
161
  function get(param) {
@@ -145,7 +164,8 @@ function get(param) {
145
164
  }
146
165
  function setProps(param, options) {
147
166
  const element = this;
148
- if (!param || !element.props) return;
167
+ if (!param || !element.props)
168
+ return;
149
169
  element.update({ props: param }, options);
150
170
  return element;
151
171
  }
@@ -172,19 +192,23 @@ function parse(excl = []) {
172
192
  const obj = {};
173
193
  const keyList = keys.call(element);
174
194
  keyList.forEach((v) => {
175
- if (excl.includes(v)) return;
195
+ if (excl.includes(v))
196
+ return;
176
197
  const val = element[v];
177
198
  if (v === "state") {
178
- if (element.__ref && !element.__ref.__hasRootState) return;
199
+ if (element.__ref && !element.__ref.__hasRootState)
200
+ return;
179
201
  const parsedVal = (0, import_utils.isFunction)(val && val.parse) ? val.parse() : val;
180
202
  obj[v] = (0, import_utils.isFunction)(parsedVal) ? parsedVal : JSON.parse(JSON.stringify(parsedVal || {}));
181
203
  } else if (v === "scope") {
182
- if (element.__ref && !element.__ref.__hasRootScope) return;
204
+ if (element.__ref && !element.__ref.__hasRootScope)
205
+ return;
183
206
  obj[v] = JSON.parse(JSON.stringify(val || {}));
184
207
  } else if (v === "props") {
185
208
  const { __element, update, ...props } = element[v];
186
209
  obj[v] = props;
187
- } else if ((0, import_utils.isDefined)(val) && Object.hasOwnProperty.call(element, v)) obj[v] = val;
210
+ } else if ((0, import_utils.isDefined)(val) && Object.hasOwnProperty.call(element, v))
211
+ obj[v] = val;
188
212
  });
189
213
  return obj;
190
214
  }
@@ -192,7 +216,8 @@ function parseDeep(excl = []) {
192
216
  const element = this;
193
217
  const obj = parse.call(element, excl);
194
218
  for (const v in obj) {
195
- if (excl.includes(v)) return;
219
+ if (excl.includes(v))
220
+ return;
196
221
  if ((0, import_utils.isObjectLike)(obj[v])) {
197
222
  obj[v] = parseDeep.call(obj[v], excl);
198
223
  }
@@ -200,7 +225,8 @@ function parseDeep(excl = []) {
200
225
  return obj;
201
226
  }
202
227
  function verbose(...args) {
203
- if (ENV !== "test" && ENV !== "development") return;
228
+ if (ENV !== "test" && ENV !== "development")
229
+ return;
204
230
  const element = this;
205
231
  const { __ref: ref } = element;
206
232
  console.groupCollapsed(element.key);
@@ -217,20 +243,22 @@ function verbose(...args) {
217
243
  return element;
218
244
  }
219
245
  function log(...params) {
220
- if (ENV === "test" || ENV === "development") {
246
+ if (ENV === "testing" || ENV === "development") {
221
247
  console.log(...params);
222
248
  }
223
249
  }
224
250
  function warn(...params) {
225
- if (ENV === "test" || ENV === "development") {
251
+ if (ENV === "testing" || ENV === "development") {
226
252
  console.warn(...params);
227
253
  }
228
254
  }
229
255
  function error(...params) {
230
256
  var _a, _b;
231
- if (ENV === "test" || ENV === "development") {
232
- if ((_a = params[params.length - 1]) == null ? void 0 : _a.debugger) debugger;
233
- if ((_b = params[params.length - 1]) == null ? void 0 : _b.verbose) verbose.call(this);
257
+ if (ENV === "testing" || ENV === "development") {
258
+ if ((_a = params[params.length - 1]) == null ? void 0 : _a.debugger)
259
+ debugger;
260
+ if ((_b = params[params.length - 1]) == null ? void 0 : _b.verbose)
261
+ verbose.call(this);
234
262
  throw new Error(...params);
235
263
  }
236
264
  }
@@ -246,14 +274,17 @@ function previousElement(el) {
246
274
  const element = el || this;
247
275
  const { key, parent } = element;
248
276
  const { __children } = parent.__ref;
249
- if (!__children) return;
277
+ if (!__children)
278
+ return;
250
279
  const currentIndex = __children.indexOf(key);
251
280
  return parent[__children[currentIndex - 1]];
252
281
  }
253
282
  function variables(obj = {}) {
254
283
  const element = this;
255
- if (!element.data) element.data = {};
256
- if (!element.data.varCaches) element.data.varCaches = {};
284
+ if (!element.data)
285
+ element.data = {};
286
+ if (!element.data.varCaches)
287
+ element.data.varCaches = {};
257
288
  const varCaches = element.data.varCaches;
258
289
  const changes = {};
259
290
  let changed;
@@ -265,7 +296,8 @@ function variables(obj = {}) {
265
296
  }
266
297
  return {
267
298
  changed: (cb) => {
268
- if (!changed) return;
299
+ if (!changed)
300
+ return;
269
301
  const returns = cb(changes, (0, import_utils.deepClone)(varCaches));
270
302
  for (const key in changes) {
271
303
  varCaches[key] = changes[key];
@@ -273,7 +305,8 @@ function variables(obj = {}) {
273
305
  return returns;
274
306
  },
275
307
  timeout: (cb, timeout) => {
276
- if (!changed) return;
308
+ if (!changed)
309
+ return;
277
310
  const t = setTimeout(() => {
278
311
  cb(changes);
279
312
  clearTimeout(t);
@@ -54,6 +54,7 @@ const addMethods = (element, parent, options = {}) => {
54
54
  error: import_index.error,
55
55
  call: import_index.call
56
56
  };
57
- if (element.context.methods) (options.strict ? import_utils.merge : import_utils.overwrite)(proto, element.context.methods);
57
+ if (element.context.methods)
58
+ (options.strict ? import_utils.merge : import_utils.overwrite)(proto, element.context.methods);
58
59
  Object.setPrototypeOf(element, proto);
59
60
  };
@@ -46,15 +46,19 @@ const parse = function(excl = []) {
46
46
  const obj = {};
47
47
  const keyList = keys.call(element);
48
48
  keyList.forEach((v) => {
49
- if (excl.includes(v)) return;
49
+ if (excl.includes(v))
50
+ return;
50
51
  let val = element[v];
51
52
  if (v === "state") {
52
- if (element.__ref && element.__ref.__hasRootState) return;
53
- if ((0, import_utils.isFunction)(val && val.parse)) val = val.parse();
53
+ if (element.__ref && element.__ref.__hasRootState)
54
+ return;
55
+ if ((0, import_utils.isFunction)(val && val.parse))
56
+ val = val.parse();
54
57
  } else if (v === "props") {
55
58
  const { __element, update, ...props } = element[v];
56
59
  obj[v] = props;
57
- } else if ((0, import_utils.isDefined)(val)) obj[v] = val;
60
+ } else if ((0, import_utils.isDefined)(val))
61
+ obj[v] = val;
58
62
  });
59
63
  return obj;
60
64
  };
@@ -62,7 +66,8 @@ const parseDeep = function(excl = []) {
62
66
  const element = this;
63
67
  const obj = parse.call(element, excl);
64
68
  for (const v in obj) {
65
- if (excl.includes(v)) return;
69
+ if (excl.includes(v))
70
+ return;
66
71
  if ((0, import_utils.isObjectLike)(obj[v])) {
67
72
  obj[v] = parseDeep.call(obj[v], excl);
68
73
  }
@@ -97,7 +102,8 @@ const previousElement = function(el) {
97
102
  const element = el || this;
98
103
  const { key, parent } = element;
99
104
  const { __children } = parent.__ref;
100
- if (!__children) return;
105
+ if (!__children)
106
+ return;
101
107
  const currentIndex = __children.indexOf(key);
102
108
  return parent[__children[currentIndex - 1]];
103
109
  };
@@ -28,13 +28,17 @@ var import_utils2 = require("../utils/index.js");
28
28
  function attr(params, element, node) {
29
29
  const { __ref: ref, props } = element;
30
30
  const { __attr } = ref;
31
- if ((0, import_utils.isNot)("object")) (0, import_report.report)("HTMLInvalidAttr", params);
31
+ if ((0, import_utils.isNot)("object"))
32
+ (0, import_report.report)("HTMLInvalidAttr", params);
32
33
  if (params) {
33
- if (props.attr) (0, import_utils2.deepMerge)(params, props.attr);
34
+ if (props.attr)
35
+ (0, import_utils2.deepMerge)(params, props.attr);
34
36
  for (const attr2 in params) {
35
37
  const val = (0, import_utils.exec)(params[attr2], element);
36
- if (val !== false && !(0, import_utils.isUndefined)(val) && !(0, import_utils.isNull)(val) && node.setAttribute) node.setAttribute(attr2, val);
37
- else if (node.removeAttribute) node.removeAttribute(attr2);
38
+ if (val !== false && !(0, import_utils.isUndefined)(val) && !(0, import_utils.isNull)(val) && node.setAttribute)
39
+ node.setAttribute(attr2, val);
40
+ else if (node.removeAttribute)
41
+ node.removeAttribute(attr2);
38
42
  __attr[attr2] = val;
39
43
  }
40
44
  }
@@ -29,7 +29,8 @@ module.exports = __toCommonJS(classList_exports);
29
29
  var import_utils = require("@domql/utils");
30
30
  const assignKeyAsClassname = (element) => {
31
31
  const { key } = element;
32
- if (element.class === true) element.class = key;
32
+ if (element.class === true)
33
+ element.class = key;
33
34
  else if (!element.class && typeof key === "string" && key.charAt(0) === "_" && key.charAt(1) !== "_") {
34
35
  element.class = key.slice(1);
35
36
  }
@@ -38,8 +39,10 @@ const classify = (obj, element) => {
38
39
  let className = "";
39
40
  for (const item in obj) {
40
41
  const param = obj[item];
41
- if (typeof param === "boolean" && param) className += ` ${item}`;
42
- else if (typeof param === "string") className += ` ${param}`;
42
+ if (typeof param === "boolean" && param)
43
+ className += ` ${item}`;
44
+ else if (typeof param === "string")
45
+ className += ` ${param}`;
43
46
  else if (typeof param === "function") {
44
47
  className += ` ${(0, import_utils.exec)(param, element)}`;
45
48
  }
@@ -47,13 +50,18 @@ const classify = (obj, element) => {
47
50
  return className;
48
51
  };
49
52
  const classList = (params, element) => {
50
- if (!params) return;
53
+ if (!params)
54
+ return;
51
55
  const { key } = element;
52
- if (params === true) params = element.class = { key };
53
- if ((0, import_utils.isString)(params)) params = element.class = { default: params };
54
- if ((0, import_utils.isObject)(params)) params = classify(params, element);
56
+ if (params === true)
57
+ params = element.class = { key };
58
+ if ((0, import_utils.isString)(params))
59
+ params = element.class = { default: params };
60
+ if ((0, import_utils.isObject)(params))
61
+ params = classify(params, element);
55
62
  const className = params.replace(/\s+/g, " ").trim();
56
- if (element.ref) element.ref.class = className;
63
+ if (element.ref)
64
+ element.ref.class = className;
57
65
  return className;
58
66
  };
59
67
  const applyClassListOnNode = (params, element, node) => {
@@ -30,37 +30,44 @@ const updateContent = function(params, options) {
30
30
  const element = this;
31
31
  const ref = element.__ref;
32
32
  const contentKey = ref.contentElementKey;
33
- if (!element[contentKey]) return;
34
- if (element[contentKey].update) element[contentKey].update(params, options);
33
+ if (!element[contentKey])
34
+ return;
35
+ if (element[contentKey].update)
36
+ element[contentKey].update(params, options);
35
37
  };
36
38
  const removeContent = function(el, opts = {}) {
37
39
  const element = el || this;
38
40
  const { __ref: ref } = element;
39
41
  const contentElementKey = (0, import_utils.setContentKey)(element, opts);
40
- if (opts.contentElementKey !== "content") opts.contentElementKey = "content";
42
+ if (opts.contentElementKey !== "content")
43
+ opts.contentElementKey = "content";
41
44
  if (element[contentElementKey]) {
42
45
  if (element[contentElementKey].node && element.node) {
43
- if (element[contentElementKey].tag === "fragment") element.node.innerHTML = "";
46
+ if (element[contentElementKey].tag === "fragment")
47
+ element.node.innerHTML = "";
44
48
  else {
45
49
  const contentNode = element[contentElementKey].node;
46
- if (contentNode.parentNode === element.node) element.node.removeChild(element[contentElementKey].node);
50
+ if (contentNode.parentNode === element.node)
51
+ element.node.removeChild(element[contentElementKey].node);
47
52
  }
48
53
  }
49
54
  const { __cached } = ref;
50
55
  if (__cached && __cached[contentElementKey]) {
51
- if (__cached[contentElementKey].tag === "fragment") __cached[contentElementKey].parent.node.innerHTML = "";
52
- else if (__cached[contentElementKey] && (0, import_utils.isFunction)(__cached[contentElementKey].remove)) __cached[contentElementKey].remove();
56
+ if (__cached[contentElementKey].tag === "fragment")
57
+ __cached[contentElementKey].parent.node.innerHTML = "";
58
+ else if (__cached[contentElementKey] && (0, import_utils.isFunction)(__cached[contentElementKey].remove))
59
+ __cached[contentElementKey].remove();
53
60
  }
54
61
  delete element[contentElementKey];
55
62
  }
56
63
  };
57
- function setContent(param, element, node, opts) {
64
+ async function setContent(param, element, node, opts) {
58
65
  const contentElementKey = (0, import_utils.setContentKey)(element, opts);
59
66
  if (param && element) {
60
67
  if (element[contentElementKey].update) {
61
68
  element[contentElementKey].update({}, opts);
62
69
  } else {
63
- import_set.set.call(element, param, opts);
70
+ await import_set.set.call(element, param, opts);
64
71
  }
65
72
  }
66
73
  }
@@ -26,9 +26,11 @@ var import_utils = require("@domql/utils");
26
26
  var import_report = require("@domql/report");
27
27
  function data(params, element, node) {
28
28
  if (params) {
29
- if (element.props.data) (0, import_utils.deepMerge)(params, element.props.data);
29
+ if (element.props.data)
30
+ (0, import_utils.deepMerge)(params, element.props.data);
30
31
  if (params.showOnNode) {
31
- if (!(0, import_utils.isObject)(params)) (0, import_report.report)("HTMLInvalidData", params);
32
+ if (!(0, import_utils.isObject)(params))
33
+ (0, import_report.report)("HTMLInvalidData", params);
32
34
  for (const dataset in params) {
33
35
  if (dataset !== "showOnNode") {
34
36
  node.dataset[dataset] = (0, import_utils.exec)(params[dataset], element);
@@ -28,8 +28,10 @@ function html(param, element, node) {
28
28
  const prop = (0, import_utils.exec)(param, element) || (0, import_utils.exec)((_a = element == null ? void 0 : element.props) == null ? void 0 : _a.html, element);
29
29
  const { __ref } = element;
30
30
  if (prop !== __ref.__html) {
31
- if (node.nodeName === "SVG") node.textContent = prop;
32
- else node.innerHTML = prop;
31
+ if (node.nodeName === "SVG")
32
+ node.textContent = prop;
33
+ else
34
+ node.innerHTML = prop;
33
35
  __ref.__html = prop;
34
36
  }
35
37
  }
@@ -24,7 +24,8 @@ __export(scope_exports, {
24
24
  module.exports = __toCommonJS(scope_exports);
25
25
  var import_utils = require("@domql/utils");
26
26
  function scope(params, element, node) {
27
- if (!(0, import_utils.isObject)(params)) return;
27
+ if (!(0, import_utils.isObject)(params))
28
+ return;
28
29
  for (const scopeItem in params) {
29
30
  const value = params[scopeItem];
30
31
  if ((0, import_utils.isFunction)(value)) {
@@ -28,8 +28,10 @@ function state(params, element, node) {
28
28
  const state2 = (0, import_utils.exec)(params, element);
29
29
  if ((0, import_utils.isObject)(state2)) {
30
30
  for (const param in state2) {
31
- if (import_state.IGNORE_STATE_PARAMS.includes(param)) continue;
32
- if (!Object.hasOwnProperty.call(state2, param)) continue;
31
+ if (import_state.IGNORE_STATE_PARAMS.includes(param))
32
+ continue;
33
+ if (!Object.hasOwnProperty.call(state2, param))
34
+ continue;
33
35
  }
34
36
  }
35
37
  return element;
@@ -26,8 +26,10 @@ var import_utils = require("@domql/utils");
26
26
  var import_report = require("@domql/report");
27
27
  function style(params, element, node) {
28
28
  if (params) {
29
- if ((0, import_utils.isObject)(params)) (0, import_utils.map)(node.style, params, element);
30
- else (0, import_report.report)("HTMLInvalidStyles", params);
29
+ if ((0, import_utils.isObject)(params))
30
+ (0, import_utils.map)(node.style, params, element);
31
+ else
32
+ (0, import_report.report)("HTMLInvalidStyles", params);
31
33
  }
32
34
  }
33
35
  var style_default = style;
@@ -33,10 +33,13 @@ function text(param, element, node) {
33
33
  node.nodeValue = prop;
34
34
  } else if (param !== void 0 || param !== null) {
35
35
  if (element.__text) {
36
- if (element.__text.text === prop) return;
36
+ if (element.__text.text === prop)
37
+ return;
37
38
  element.__text.text = prop;
38
- if (element.__text.node) element.__text.node.nodeValue = prop;
39
- } else (0, import_create.create)({ tag: "string", text: prop }, element, "__text");
39
+ if (element.__text.node)
40
+ element.__text.node.nodeValue = prop;
41
+ } else
42
+ (0, import_create.create)({ tag: "string", text: prop }, element, "__text");
40
43
  }
41
44
  }
42
45
  var text_default = text;
package/dist/cjs/node.js CHANGED
@@ -37,15 +37,18 @@ const createNode = async (element, options) => {
37
37
  let isNewNode;
38
38
  if (!node) {
39
39
  isNewNode = true;
40
- if (!ref.__if) return element;
40
+ if (!ref.__if)
41
+ return element;
41
42
  if (tag === "shadow") {
42
43
  node = element.node = element.parent.node.attachShadow({ mode: "open" });
43
- } else node = element.node = (0, import_render.cacheNode)(element);
44
+ } else
45
+ node = element.node = (0, import_render.cacheNode)(element);
44
46
  (0, import_event.triggerEventOn)("attachNode", element, options);
45
47
  }
46
- if (ENV === "test" || ENV === "development" || options.alowRefReference) {
48
+ if (ENV === "testing" || ENV === "development" || options.alowRefReference) {
47
49
  node.ref = element;
48
- if ((0, import_utils.isFunction)(node.setAttribute)) node.setAttribute("key", element.key);
50
+ if ((0, import_utils.isFunction)(node.setAttribute))
51
+ node.setAttribute("key", element.key);
49
52
  }
50
53
  (0, import_iterate.throughExecProps)(element);
51
54
  (0, import_iterate.throughInitialDefine)(element);
@@ -58,8 +61,10 @@ const createNode = async (element, options) => {
58
61
  }
59
62
  for (const param in element) {
60
63
  const value = element[param];
61
- if (!Object.hasOwnProperty.call(element, param)) continue;
62
- if ((0, import_utils.isUndefined)(value) || (0, import_methods.isMethod)(param, element) || (0, import_utils.isVariant)(param) || (0, import_utils.isObject)(import_mixins.REGISTRY[param])) continue;
64
+ if (!Object.hasOwnProperty.call(element, param))
65
+ continue;
66
+ if ((0, import_utils.isUndefined)(value) || (0, import_methods.isMethod)(param, element) || (0, import_utils.isVariant)(param) || (0, import_utils.isObject)(import_mixins.REGISTRY[param]))
67
+ continue;
63
68
  const isElement = (0, import_applyParam.applyParam)(param, element, options);
64
69
  if (isElement) {
65
70
  const { hasDefine, hasContextDefine } = isElement;
@@ -74,7 +79,8 @@ const createNode = async (element, options) => {
74
79
  (0, import_event.triggerEventOn)("lazyLoad", element, options);
75
80
  }
76
81
  });
77
- } else await createAsync();
82
+ } else
83
+ await createAsync();
78
84
  }
79
85
  }
80
86
  }
@@ -28,12 +28,16 @@ var import_inherit = require("./inherit.js");
28
28
  const createPropsStack = (element, parent) => {
29
29
  const { props, __ref: ref } = element;
30
30
  const propsStack = ref.__props = (0, import_inherit.inheritParentProps)(element, parent);
31
- if ((0, import_utils.isObject)(props)) propsStack.push(props);
32
- else if (props === "inherit" && parent.props) propsStack.push(parent.props);
33
- else if (props) propsStack.push(props);
31
+ if ((0, import_utils.isObject)(props))
32
+ propsStack.push(props);
33
+ else if (props === "inherit" && parent.props)
34
+ propsStack.push(parent.props);
35
+ else if (props)
36
+ propsStack.push(props);
34
37
  if ((0, import_utils.isArray)(ref.__extend)) {
35
38
  ref.__extend.forEach((extend) => {
36
- if (extend.props && extend.props !== props) propsStack.push(extend.props);
39
+ if (extend.props && extend.props !== props)
40
+ propsStack.push(extend.props);
37
41
  });
38
42
  }
39
43
  ref.__props = propsStack;
@@ -43,7 +47,8 @@ const syncProps = (props, element, opts) => {
43
47
  element.props = {};
44
48
  const mergedProps = {};
45
49
  props.forEach((v) => {
46
- if (import_ignore.IGNORE_PROPS_PARAMS.includes(v)) return;
50
+ if (import_ignore.IGNORE_PROPS_PARAMS.includes(v))
51
+ return;
47
52
  let execProps;
48
53
  try {
49
54
  execProps = (0, import_utils.exec)(v, element);
@@ -73,7 +78,8 @@ const createProps = function(element, parent, options) {
73
78
  element.props = {};
74
79
  }
75
80
  };
76
- if (ref.__if) applyProps();
81
+ if (ref.__if)
82
+ applyProps();
77
83
  else {
78
84
  try {
79
85
  applyProps();
@@ -38,7 +38,8 @@ const inheritParentProps = (element, parent) => {
38
38
  if (matchParent) {
39
39
  if (matchParentIsString) {
40
40
  const inheritedStringExists = propsStack.filter((v) => v.inheritedString)[0];
41
- if (inheritedStringExists) inheritedStringExists.inheritedString = matchParent;
41
+ if (inheritedStringExists)
42
+ inheritedStringExists.inheritedString = matchParent;
42
43
  else {
43
44
  propsStack = [].concat(objectizeStringProperty(matchParent), propsStack);
44
45
  }
@@ -46,6 +47,7 @@ const inheritParentProps = (element, parent) => {
46
47
  propsStack.push(objectizeStringProperty(matchParent));
47
48
  }
48
49
  }
49
- if (matchParentChildProps && !((_a = element == null ? void 0 : element.props) == null ? void 0 : _a.ignoreChildProps)) propsStack.push(matchParentChildProps);
50
+ if (matchParentChildProps && !((_a = element == null ? void 0 : element.props) == null ? void 0 : _a.ignoreChildProps))
51
+ propsStack.push(matchParentChildProps);
50
52
  return propsStack;
51
53
  };
@@ -27,8 +27,11 @@ const updateProps = (newProps, element, parent) => {
27
27
  const { __ref } = element;
28
28
  let propsStack = __ref.__props;
29
29
  const parentProps = (0, import_inherit.inheritParentProps)(element, parent);
30
- if (parentProps.length) propsStack = __ref.__props = [].concat(parentProps, propsStack);
31
- if (newProps) propsStack = __ref.__props = [].concat(newProps, propsStack);
32
- if (propsStack) (0, import_create.syncProps)(propsStack, element);
30
+ if (parentProps.length)
31
+ propsStack = __ref.__props = [].concat(parentProps, propsStack);
32
+ if (newProps)
33
+ propsStack = __ref.__props = [].concat(newProps, propsStack);
34
+ if (propsStack)
35
+ (0, import_create.syncProps)(propsStack, element);
33
36
  return element;
34
37
  };