@domql/element 2.30.2 → 2.31.1

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.
@@ -93,6 +93,10 @@ function lookdown(param) {
93
93
  for (let i = 0; i < children.length; i++) {
94
94
  const v = children[i];
95
95
  const childElem = el[v];
96
+ if (!childElem)
97
+ return this.warn(
98
+ "Element found in children array but it does not exist in parent"
99
+ );
96
100
  if (v === param) return childElem;
97
101
  else if ((0, import_utils.isFunction)(param)) {
98
102
  const exec = param(childElem, childElem.state, childElem.context);
@@ -305,8 +309,7 @@ function variables(obj = {}) {
305
309
  };
306
310
  }
307
311
  function call(fnKey, ...args) {
308
- var _a, _b, _c, _d;
309
- const fn = ((_a = this.context.utils) == null ? void 0 : _a[fnKey]) || ((_b = this.context.functions) == null ? void 0 : _b[fnKey]) || ((_c = this.context.methods) == null ? void 0 : _c[fnKey]) || ((_d = this.context.snippets) == null ? void 0 : _d[fnKey]);
312
+ const fn = import_utils.getContextFunction.call(this, fnKey);
310
313
  if (!fn) return void 0;
311
314
  try {
312
315
  const result = fn.call(this, ...args);
@@ -46,6 +46,7 @@ const REGISTRY = {
46
46
  deps: (param, el) => param || el.parent.deps,
47
47
  extend: {},
48
48
  helmet: {},
49
+ metadata: {},
49
50
  childExtend: {},
50
51
  childExtendRecursive: {},
51
52
  props: {},
@@ -6,7 +6,8 @@ import {
6
6
  isObjectLike,
7
7
  isProduction,
8
8
  removeValueFromArray,
9
- deepClone
9
+ deepClone,
10
+ getContextFunction
10
11
  } from "@domql/utils";
11
12
  import { TREE } from "../tree.js";
12
13
  import { parseFilters, REGISTRY } from "../mixins/index.js";
@@ -51,6 +52,10 @@ function lookdown(param) {
51
52
  for (let i = 0; i < children.length; i++) {
52
53
  const v = children[i];
53
54
  const childElem = el[v];
55
+ if (!childElem)
56
+ return this.warn(
57
+ "Element found in children array but it does not exist in parent"
58
+ );
54
59
  if (v === param) return childElem;
55
60
  else if (isFunction(param)) {
56
61
  const exec = param(childElem, childElem.state, childElem.context);
@@ -263,8 +268,7 @@ function variables(obj = {}) {
263
268
  };
264
269
  }
265
270
  function call(fnKey, ...args) {
266
- var _a, _b, _c, _d;
267
- const fn = ((_a = this.context.utils) == null ? void 0 : _a[fnKey]) || ((_b = this.context.functions) == null ? void 0 : _b[fnKey]) || ((_c = this.context.methods) == null ? void 0 : _c[fnKey]) || ((_d = this.context.snippets) == null ? void 0 : _d[fnKey]);
271
+ const fn = getContextFunction.call(this, fnKey);
268
272
  if (!fn) return void 0;
269
273
  try {
270
274
  const result = fn.call(this, ...args);
@@ -20,6 +20,7 @@ const REGISTRY = {
20
20
  deps: (param, el) => param || el.parent.deps,
21
21
  extend: {},
22
22
  helmet: {},
23
+ metadata: {},
23
24
  childExtend: {},
24
25
  childExtendRecursive: {},
25
26
  props: {},
package/methods/index.js CHANGED
@@ -8,7 +8,8 @@ import {
8
8
  isObjectLike,
9
9
  isProduction,
10
10
  removeValueFromArray,
11
- deepClone
11
+ deepClone,
12
+ getContextFunction
12
13
  } from '@domql/utils'
13
14
  import { TREE } from '../tree.js'
14
15
  import { parseFilters, REGISTRY } from '../mixins/index.js'
@@ -67,6 +68,11 @@ export function lookdown(param) {
67
68
  const v = children[i]
68
69
  const childElem = el[v]
69
70
 
71
+ if (!childElem)
72
+ return this.warn(
73
+ 'Element found in children array but it does not exist in parent'
74
+ )
75
+
70
76
  if (v === param) return childElem
71
77
  else if (isFunction(param)) {
72
78
  const exec = param(childElem, childElem.state, childElem.context)
@@ -340,12 +346,7 @@ export function variables(obj = {}) {
340
346
  * @returns {any|Promise} - The result or a Promise to the result
341
347
  */
342
348
  export function call(fnKey, ...args) {
343
- const fn =
344
- this.context.utils?.[fnKey] ||
345
- this.context.functions?.[fnKey] ||
346
- this.context.methods?.[fnKey] ||
347
- this.context.snippets?.[fnKey]
348
-
349
+ const fn = getContextFunction.call(this, fnKey)
349
350
  if (!fn) return undefined
350
351
 
351
352
  try {
@@ -25,6 +25,7 @@ export const REGISTRY = {
25
25
 
26
26
  extend: {},
27
27
  helmet: {},
28
+ metadata: {},
28
29
  childExtend: {},
29
30
  childExtendRecursive: {},
30
31
  props: {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/element",
3
- "version": "2.30.2",
3
+ "version": "2.31.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "index.js",
@@ -27,12 +27,12 @@
27
27
  "prepublish": "npx rimraf -I dist && npm run build && npm run copy:package:cjs"
28
28
  },
29
29
  "dependencies": {
30
- "@domql/event": "^2.30.2",
31
- "@domql/render": "^2.30.2",
32
- "@domql/state": "^2.30.2",
33
- "@domql/utils": "^2.30.2"
30
+ "@domql/event": "^2.31.1",
31
+ "@domql/render": "^2.31.1",
32
+ "@domql/state": "^2.31.1",
33
+ "@domql/utils": "^2.31.1"
34
34
  },
35
- "gitHead": "f16f5ece1e6e13dc967e183452017b49a104cca1",
35
+ "gitHead": "6ac409576cc3b2ac653e9601d5a8c2bed90b83de",
36
36
  "devDependencies": {
37
37
  "@babel/core": "^7.27.1"
38
38
  }