@domql/element 2.31.37 → 2.32.0

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.
@@ -66,7 +66,7 @@ const throughUpdatedExec = async (element, options = { excludes: import_utils2.M
66
66
  }
67
67
  return changes;
68
68
  };
69
- const throughExecProps = (element) => {
69
+ const throughExecProps = (element, opts) => {
70
70
  const { __ref: ref } = element;
71
71
  const { props } = element;
72
72
  for (const k in props) {
@@ -75,14 +75,20 @@ const throughExecProps = (element) => {
75
75
  return import_methods.warn.call(element, "Element was not initiated to execute props");
76
76
  const cachedExecProp = ref.__execProps[k];
77
77
  if ((0, import_utils.isFunction)(cachedExecProp)) {
78
- props[k] = (0, import_utils.exec)(cachedExecProp, element);
78
+ props[k] = (0, import_utils.exec)(
79
+ cachedExecProp,
80
+ element,
81
+ element.state,
82
+ element.context,
83
+ opts
84
+ );
79
85
  } else if (isDefine && (0, import_utils.isFunction)(props[k])) {
80
86
  ref.__execProps[k] = props[k];
81
- props[k] = (0, import_utils.exec)(props[k], element);
87
+ props[k] = (0, import_utils.exec)(props[k], element, element.state, element.context, opts);
82
88
  }
83
89
  }
84
90
  };
85
- const throughInitialDefine = async (element) => {
91
+ const throughInitialDefine = async (element, opts) => {
86
92
  const { define, context, __ref: ref } = element;
87
93
  let defineObj = {};
88
94
  const hasGlobalDefine = context && (0, import_utils.isObject)(context.define);
@@ -92,7 +98,13 @@ const throughInitialDefine = async (element) => {
92
98
  let elementProp = element[param];
93
99
  if ((0, import_utils.isFunction)(elementProp) && !(0, import_methods.isMethod)(param, element) && !(0, import_utils.isVariant)(param)) {
94
100
  ref.__exec[param] = elementProp;
95
- const execParam2 = elementProp = await (0, import_utils.exec)(elementProp, element);
101
+ const execParam2 = elementProp = await (0, import_utils.exec)(
102
+ elementProp,
103
+ element,
104
+ element.state,
105
+ element.context,
106
+ opts
107
+ );
96
108
  if (execParam2) {
97
109
  elementProp = element[param] = execParam2.parse ? execParam2.parse() : execParam2;
98
110
  ref.__defineCache[param] = elementProp;
@@ -108,7 +120,7 @@ const throughInitialDefine = async (element) => {
108
120
  }
109
121
  return element;
110
122
  };
111
- const throughUpdatedDefine = async (element) => {
123
+ const throughUpdatedDefine = async (element, opts) => {
112
124
  const { context, define, __ref: ref } = element;
113
125
  const changes = {};
114
126
  let obj = {};
@@ -122,7 +134,13 @@ const throughUpdatedDefine = async (element) => {
122
134
  element.state,
123
135
  element.context
124
136
  );
125
- const cached = await (0, import_utils.exec)(ref.__defineCache[param], element);
137
+ const cached = await (0, import_utils.exec)(
138
+ ref.__defineCache[param],
139
+ element,
140
+ element.state,
141
+ element.context,
142
+ opts
143
+ );
126
144
  const newExecParam = await obj[param](
127
145
  cached,
128
146
  element,
@@ -25,16 +25,25 @@ module.exports = __toCommonJS(attr_exports);
25
25
  var import_utils = require("@domql/utils");
26
26
  var import_report = require("@domql/report");
27
27
  var import_utils2 = require("../utils/index.js");
28
- function attr(params, element, node) {
28
+ function attr(params, element, node, opts) {
29
29
  const { __ref: ref, props } = element;
30
30
  const { __attr } = ref;
31
31
  if ((0, import_utils.isNot)("object")) (0, import_report.report)("HTMLInvalidAttr", params);
32
32
  if (params) {
33
33
  if (props.attr) (0, import_utils2.deepMerge)(params, props.attr);
34
34
  for (const attr2 in params) {
35
- const val = (0, import_utils.exec)(params[attr2], element);
35
+ const val = (0, import_utils.exec)(
36
+ params[attr2],
37
+ element,
38
+ element.state,
39
+ element.context,
40
+ opts
41
+ );
36
42
  if (val !== false && !(0, import_utils.isUndefined)(val) && !(0, import_utils.isNull)(val) && node.setAttribute)
37
- node.setAttribute(attr2, (0, import_utils.exec)(val, element));
43
+ node.setAttribute(
44
+ attr2,
45
+ (0, import_utils.exec)(val, element, element.state, element.context, opts)
46
+ );
38
47
  else if (node.removeAttribute) node.removeAttribute(attr2);
39
48
  __attr[attr2] = val;
40
49
  }
@@ -34,34 +34,34 @@ const assignKeyAsClassname = (element) => {
34
34
  element.class = key.slice(1);
35
35
  }
36
36
  };
37
- const classify = (obj, element) => {
37
+ const classify = (obj, element, opts) => {
38
38
  let className = "";
39
39
  for (const item in obj) {
40
40
  const param = obj[item];
41
41
  if (typeof param === "boolean" && param) className += ` ${item}`;
42
42
  else if (typeof param === "string") className += ` ${param}`;
43
43
  else if (typeof param === "function") {
44
- className += ` ${(0, import_utils.exec)(param, element)}`;
44
+ className += ` ${(0, import_utils.exec)(param, element, element.state, element.context, opts)}`;
45
45
  }
46
46
  }
47
47
  return className;
48
48
  };
49
- const classList = (params, element) => {
49
+ const classList = (params, element, opts) => {
50
50
  if (!params) return;
51
51
  const { key } = element;
52
52
  if (params === true) params = element.class = { key };
53
53
  if ((0, import_utils.isString)(params)) params = element.class = { default: params };
54
- if ((0, import_utils.isObject)(params)) params = classify(params, element);
54
+ if ((0, import_utils.isObject)(params)) params = classify(params, element, opts);
55
55
  const className = params.replace(/\s+/g, " ").trim();
56
56
  if (element.ref) element.ref.class = className;
57
57
  return className;
58
58
  };
59
- const applyClassListOnNode = (params, element, node) => {
60
- const className = classList(params, element);
59
+ const applyClassListOnNode = (params, element, node, opts) => {
60
+ const className = classList(params, element, opts);
61
61
  node.classList = className;
62
62
  return className;
63
63
  };
64
- function applyClasslist(params, element, node) {
65
- applyClassListOnNode(params, element, node);
64
+ function applyClasslist(params, element, node, opts) {
65
+ applyClassListOnNode(params, element, node, opts);
66
66
  }
67
67
  var classList_default = applyClasslist;
@@ -23,9 +23,9 @@ __export(html_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(html_exports);
25
25
  var import_utils = require("@domql/utils");
26
- function html(param, element, node) {
26
+ function html(param, element, node, opts) {
27
27
  var _a;
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);
28
+ const prop = (0, import_utils.exec)(param, element, element.state, element.context, opts) || (0, import_utils.exec)((_a = element == null ? void 0 : element.props) == null ? void 0 : _a.html, element, element.state, element.context, opts);
29
29
  const { __ref } = element;
30
30
  if (prop !== __ref.__html) {
31
31
  if (node.nodeName === "SVG") node.textContent = prop;
@@ -24,8 +24,8 @@ __export(state_exports, {
24
24
  module.exports = __toCommonJS(state_exports);
25
25
  var import_state = require("@domql/state");
26
26
  var import_utils = require("@domql/utils");
27
- async function state(params, element, node) {
28
- const state2 = (0, import_utils.exec)(params, element);
27
+ async function state(params, element, node, opts) {
28
+ const state2 = (0, import_utils.exec)(params, element, element.state, element.context, opts);
29
29
  if ((0, import_utils.isObject)(state2)) {
30
30
  for (const param in state2) {
31
31
  if (import_state.IGNORE_STATE_PARAMS.includes(param)) continue;
@@ -24,8 +24,8 @@ __export(text_exports, {
24
24
  module.exports = __toCommonJS(text_exports);
25
25
  var import_create = require("../create.js");
26
26
  var import_utils = require("@domql/utils");
27
- function text(param, element, node) {
28
- let prop = (0, import_utils.exec)(param, element);
27
+ function text(param, element, node, opts) {
28
+ let prop = (0, import_utils.exec)(param, element, element.state, element.context, opts);
29
29
  if ((0, import_utils.isString)(prop) && prop.includes("{{")) {
30
30
  prop = element.call("replaceLiteralsWithObjectFields", prop);
31
31
  }
package/dist/cjs/node.js CHANGED
@@ -31,7 +31,6 @@ var import_iterate = require("./iterate.js");
31
31
  var import_mixins = require("./mixins/index.js");
32
32
  var import_applyParam = require("./utils/applyParam.js");
33
33
  var import_propEvents = require("./utils/propEvents.js");
34
- var import_env = require("@domql/utils/env.js");
35
34
  const createNode = async (element, options) => {
36
35
  let { node, tag, __ref: ref } = element;
37
36
  let isNewNode;
@@ -48,8 +47,8 @@ const createNode = async (element, options) => {
48
47
  }
49
48
  node.ref = element;
50
49
  if ((0, import_utils.isFunction)(node.setAttribute)) node.setAttribute("key", element.key);
51
- (0, import_iterate.throughExecProps)(element);
52
- await (0, import_iterate.throughInitialDefine)(element);
50
+ (0, import_iterate.throughExecProps)(element, options);
51
+ await (0, import_iterate.throughInitialDefine)(element, options);
53
52
  await (0, import_iterate.throughInitialExec)(element);
54
53
  if (element.tag !== "string" && element.tag !== "fragment") {
55
54
  (0, import_propEvents.propagateEventsFromProps)(element);
@@ -46,7 +46,7 @@ const syncProps = async (props, element, opts) => {
46
46
  if (import_ignore.IGNORE_PROPS_PARAMS.includes(v)) return;
47
47
  let execProps;
48
48
  try {
49
- execProps = (0, import_utils.exec)(v, element);
49
+ execProps = (0, import_utils.exec)(v, element, element.state, element.context, opts);
50
50
  } catch (e) {
51
51
  element.error(e, opts);
52
52
  }
@@ -57,7 +57,10 @@ const syncProps = async (props, element, opts) => {
57
57
  );
58
58
  });
59
59
  element.props = mergedProps;
60
- const methods = { update: await update.bind(element.props), __element: element };
60
+ const methods = {
61
+ update: await update.bind(element.props),
62
+ __element: element
63
+ };
61
64
  Object.setPrototypeOf(element.props, methods);
62
65
  return element.props;
63
66
  };
@@ -67,7 +70,7 @@ const createProps = function(element, parent, options) {
67
70
  const propsStack = options.cachedProps || createPropsStack(element, parent);
68
71
  if (propsStack.length) {
69
72
  ref.__props = propsStack;
70
- syncProps(propsStack, element);
73
+ syncProps(propsStack, element, options);
71
74
  } else {
72
75
  ref.__props = options.cachedProps || [];
73
76
  element.props = {};
@@ -80,7 +83,7 @@ const createProps = function(element, parent, options) {
80
83
  } catch (e) {
81
84
  element.props = {};
82
85
  ref.__props = options.cachedProps || [];
83
- element.error("Error applying props", e);
86
+ element.error("Error applying props", e, options);
84
87
  }
85
88
  }
86
89
  const methods = { update: update.bind(element.props), __element: element };
@@ -23,12 +23,13 @@ __export(update_exports, {
23
23
  module.exports = __toCommonJS(update_exports);
24
24
  var import_create = require("./create.js");
25
25
  var import_inherit = require("./inherit.js");
26
- const updateProps = (newProps, element, parent) => {
26
+ const updateProps = (newProps, element, parent, opts) => {
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);
30
+ if (parentProps.length)
31
+ propsStack = __ref.__props = [].concat(parentProps, propsStack);
31
32
  if (newProps) propsStack = __ref.__props = [].concat(newProps, propsStack);
32
- if (propsStack) (0, import_create.syncProps)(propsStack, element);
33
+ if (propsStack) (0, import_create.syncProps)(propsStack, element, opts);
33
34
  return element;
34
35
  };
package/dist/cjs/set.js CHANGED
@@ -52,14 +52,34 @@ const reset = async (options) => {
52
52
  const set = async function(params, options = {}, el) {
53
53
  var _a, _b, _c;
54
54
  const element = el || this;
55
+ const { __ref: ref } = element;
56
+ console.warn(params);
55
57
  if (options.preventContentUpdate || options.preventUpdate && ((_b = (_a = options.preventUpdate).includes) == null ? void 0 : _b.call(_a, "content")))
56
58
  return;
57
59
  if (options.routerContentElement && options.lastElement) {
58
60
  if (options.routerContentElement !== options.lastElement.content) return;
59
61
  }
62
+ const contentKey = (0, import_utils.setContentKey)(element, options);
63
+ const content = element[contentKey];
64
+ const __contentRef = content && content.__ref;
60
65
  const lazyLoad = element.props && element.props.lazyLoad;
61
66
  const hasCollection = element.$collection || element.$stateCollection || element.$propsCollection;
62
67
  if (options.preventContentUpdate === true && !hasCollection) return;
68
+ if (ref.__noCollectionDifference || __contentRef && __contentRef.__cached && (0, import_utils.deepContains)(params, content)) {
69
+ if (!options.preventBeforeUpdateListener && !options.preventListeners) {
70
+ const beforeUpdateReturns = await (0, import_event.triggerEventOnUpdate)(
71
+ "beforeUpdate",
72
+ params,
73
+ element,
74
+ options
75
+ );
76
+ if (beforeUpdateReturns === false) return element;
77
+ }
78
+ if (content == null ? void 0 : content.update) await content.update();
79
+ if (!options.preventUpdateListener)
80
+ await (0, import_event.triggerEventOn)("update", element, options);
81
+ return;
82
+ }
63
83
  if (params) {
64
84
  let { childExtend, props } = params;
65
85
  if (!props) props = params.props = {};
@@ -80,7 +80,7 @@ const update = async function(params = {}, opts) {
80
80
  const hasParentProps = parent.props && (parent.props[key] || parent.props.childProps);
81
81
  const hasFunctionInProps = ref.__props.filter((v) => (0, import_utils.isFunction)(v));
82
82
  const props = params.props || hasParentProps || hasFunctionInProps.length;
83
- if (props) (0, import_props.updateProps)(props, element, parent);
83
+ if (props) (0, import_props.updateProps)(props, element, parent, options);
84
84
  }
85
85
  if (!options.preventBeforeUpdateListener && !options.preventListeners) {
86
86
  const beforeUpdateReturns = await (0, import_event.triggerEventOnUpdate)(
@@ -92,9 +92,9 @@ const update = async function(params = {}, opts) {
92
92
  if (beforeUpdateReturns === false) return element;
93
93
  }
94
94
  (0, import_utils.overwriteDeep)(element, params, { exclude: import_utils2.METHODS_EXL });
95
- (0, import_iterate.throughExecProps)(element);
95
+ (0, import_iterate.throughExecProps)(element, options);
96
96
  await (0, import_iterate.throughUpdatedExec)(element, { ignore: UPDATE_DEFAULT_OPTIONS });
97
- await (0, import_iterate.throughUpdatedDefine)(element);
97
+ await (0, import_iterate.throughUpdatedDefine)(element, options);
98
98
  if (!options.isForced && !options.preventListeners) {
99
99
  await (0, import_event.triggerEventOn)("beforeClassAssign", element, options);
100
100
  }
@@ -25,7 +25,13 @@ var import_utils = require("@domql/utils");
25
25
  var import_mixins = require("../mixins/index.js");
26
26
  const applyParam = async (param, element, options) => {
27
27
  const { node, context, __ref: ref } = element;
28
- const prop = await (0, import_utils.exec)(element[param], element);
28
+ const prop = await (0, import_utils.exec)(
29
+ element[param],
30
+ element,
31
+ element.state,
32
+ element.context,
33
+ options
34
+ );
29
35
  const { onlyUpdate } = options;
30
36
  const DOMQLProperty = import_mixins.REGISTRY[param];
31
37
  const DOMQLPropertyFromContext = context && context.registry && context.registry[param];
@@ -48,7 +48,7 @@ const throughUpdatedExec = async (element, options = { excludes: METHODS_EXL })
48
48
  }
49
49
  return changes;
50
50
  };
51
- const throughExecProps = (element) => {
51
+ const throughExecProps = (element, opts) => {
52
52
  const { __ref: ref } = element;
53
53
  const { props } = element;
54
54
  for (const k in props) {
@@ -57,14 +57,20 @@ const throughExecProps = (element) => {
57
57
  return warn.call(element, "Element was not initiated to execute props");
58
58
  const cachedExecProp = ref.__execProps[k];
59
59
  if (isFunction(cachedExecProp)) {
60
- props[k] = exec(cachedExecProp, element);
60
+ props[k] = exec(
61
+ cachedExecProp,
62
+ element,
63
+ element.state,
64
+ element.context,
65
+ opts
66
+ );
61
67
  } else if (isDefine && isFunction(props[k])) {
62
68
  ref.__execProps[k] = props[k];
63
- props[k] = exec(props[k], element);
69
+ props[k] = exec(props[k], element, element.state, element.context, opts);
64
70
  }
65
71
  }
66
72
  };
67
- const throughInitialDefine = async (element) => {
73
+ const throughInitialDefine = async (element, opts) => {
68
74
  const { define, context, __ref: ref } = element;
69
75
  let defineObj = {};
70
76
  const hasGlobalDefine = context && isObject(context.define);
@@ -74,7 +80,13 @@ const throughInitialDefine = async (element) => {
74
80
  let elementProp = element[param];
75
81
  if (isFunction(elementProp) && !isMethod(param, element) && !isVariant(param)) {
76
82
  ref.__exec[param] = elementProp;
77
- const execParam2 = elementProp = await exec(elementProp, element);
83
+ const execParam2 = elementProp = await exec(
84
+ elementProp,
85
+ element,
86
+ element.state,
87
+ element.context,
88
+ opts
89
+ );
78
90
  if (execParam2) {
79
91
  elementProp = element[param] = execParam2.parse ? execParam2.parse() : execParam2;
80
92
  ref.__defineCache[param] = elementProp;
@@ -90,7 +102,7 @@ const throughInitialDefine = async (element) => {
90
102
  }
91
103
  return element;
92
104
  };
93
- const throughUpdatedDefine = async (element) => {
105
+ const throughUpdatedDefine = async (element, opts) => {
94
106
  const { context, define, __ref: ref } = element;
95
107
  const changes = {};
96
108
  let obj = {};
@@ -104,7 +116,13 @@ const throughUpdatedDefine = async (element) => {
104
116
  element.state,
105
117
  element.context
106
118
  );
107
- const cached = await exec(ref.__defineCache[param], element);
119
+ const cached = await exec(
120
+ ref.__defineCache[param],
121
+ element,
122
+ element.state,
123
+ element.context,
124
+ opts
125
+ );
108
126
  const newExecParam = await obj[param](
109
127
  cached,
110
128
  element,
@@ -1,16 +1,25 @@
1
1
  import { exec, isNot, isNull, isUndefined } from "@domql/utils";
2
2
  import { report } from "@domql/report";
3
3
  import { deepMerge } from "../utils/index.js";
4
- function attr(params, element, node) {
4
+ function attr(params, element, node, opts) {
5
5
  const { __ref: ref, props } = element;
6
6
  const { __attr } = ref;
7
7
  if (isNot("object")) report("HTMLInvalidAttr", params);
8
8
  if (params) {
9
9
  if (props.attr) deepMerge(params, props.attr);
10
10
  for (const attr2 in params) {
11
- const val = exec(params[attr2], element);
11
+ const val = exec(
12
+ params[attr2],
13
+ element,
14
+ element.state,
15
+ element.context,
16
+ opts
17
+ );
12
18
  if (val !== false && !isUndefined(val) && !isNull(val) && node.setAttribute)
13
- node.setAttribute(attr2, exec(val, element));
19
+ node.setAttribute(
20
+ attr2,
21
+ exec(val, element, element.state, element.context, opts)
22
+ );
14
23
  else if (node.removeAttribute) node.removeAttribute(attr2);
15
24
  __attr[attr2] = val;
16
25
  }
@@ -6,35 +6,35 @@ const assignKeyAsClassname = (element) => {
6
6
  element.class = key.slice(1);
7
7
  }
8
8
  };
9
- const classify = (obj, element) => {
9
+ const classify = (obj, element, opts) => {
10
10
  let className = "";
11
11
  for (const item in obj) {
12
12
  const param = obj[item];
13
13
  if (typeof param === "boolean" && param) className += ` ${item}`;
14
14
  else if (typeof param === "string") className += ` ${param}`;
15
15
  else if (typeof param === "function") {
16
- className += ` ${exec(param, element)}`;
16
+ className += ` ${exec(param, element, element.state, element.context, opts)}`;
17
17
  }
18
18
  }
19
19
  return className;
20
20
  };
21
- const classList = (params, element) => {
21
+ const classList = (params, element, opts) => {
22
22
  if (!params) return;
23
23
  const { key } = element;
24
24
  if (params === true) params = element.class = { key };
25
25
  if (isString(params)) params = element.class = { default: params };
26
- if (isObject(params)) params = classify(params, element);
26
+ if (isObject(params)) params = classify(params, element, opts);
27
27
  const className = params.replace(/\s+/g, " ").trim();
28
28
  if (element.ref) element.ref.class = className;
29
29
  return className;
30
30
  };
31
- const applyClassListOnNode = (params, element, node) => {
32
- const className = classList(params, element);
31
+ const applyClassListOnNode = (params, element, node, opts) => {
32
+ const className = classList(params, element, opts);
33
33
  node.classList = className;
34
34
  return className;
35
35
  };
36
- function applyClasslist(params, element, node) {
37
- applyClassListOnNode(params, element, node);
36
+ function applyClasslist(params, element, node, opts) {
37
+ applyClassListOnNode(params, element, node, opts);
38
38
  }
39
39
  var classList_default = applyClasslist;
40
40
  export {
@@ -1,7 +1,7 @@
1
1
  import { exec } from "@domql/utils";
2
- function html(param, element, node) {
2
+ function html(param, element, node, opts) {
3
3
  var _a;
4
- const prop = exec(param, element) || exec((_a = element == null ? void 0 : element.props) == null ? void 0 : _a.html, element);
4
+ const prop = exec(param, element, element.state, element.context, opts) || exec((_a = element == null ? void 0 : element.props) == null ? void 0 : _a.html, element, element.state, element.context, opts);
5
5
  const { __ref } = element;
6
6
  if (prop !== __ref.__html) {
7
7
  if (node.nodeName === "SVG") node.textContent = prop;
@@ -1,7 +1,7 @@
1
1
  import { IGNORE_STATE_PARAMS } from "@domql/state";
2
2
  import { exec, isObject } from "@domql/utils";
3
- async function state(params, element, node) {
4
- const state2 = exec(params, element);
3
+ async function state(params, element, node, opts) {
4
+ const state2 = exec(params, element, element.state, element.context, opts);
5
5
  if (isObject(state2)) {
6
6
  for (const param in state2) {
7
7
  if (IGNORE_STATE_PARAMS.includes(param)) continue;
@@ -1,10 +1,7 @@
1
1
  import { create } from "../create.js";
2
- import {
3
- exec,
4
- isString
5
- } from "@domql/utils";
6
- function text(param, element, node) {
7
- let prop = exec(param, element);
2
+ import { exec, isString } from "@domql/utils";
3
+ function text(param, element, node, opts) {
4
+ let prop = exec(param, element, element.state, element.context, opts);
8
5
  if (isString(prop) && prop.includes("{{")) {
9
6
  prop = element.call("replaceLiteralsWithObjectFields", prop);
10
7
  }
package/dist/esm/node.js CHANGED
@@ -17,7 +17,6 @@ import {
17
17
  import { REGISTRY } from "./mixins/index.js";
18
18
  import { applyParam } from "./utils/applyParam.js";
19
19
  import { propagateEventsFromProps } from "./utils/propEvents.js";
20
- import { isNotProduction } from "@domql/utils/env.js";
21
20
  const createNode = async (element, options) => {
22
21
  let { node, tag, __ref: ref } = element;
23
22
  let isNewNode;
@@ -34,8 +33,8 @@ const createNode = async (element, options) => {
34
33
  }
35
34
  node.ref = element;
36
35
  if (isFunction(node.setAttribute)) node.setAttribute("key", element.key);
37
- throughExecProps(element);
38
- await throughInitialDefine(element);
36
+ throughExecProps(element, options);
37
+ await throughInitialDefine(element, options);
39
38
  await throughInitialExec(element);
40
39
  if (element.tag !== "string" && element.tag !== "fragment") {
41
40
  propagateEventsFromProps(element);
@@ -22,7 +22,7 @@ const syncProps = async (props, element, opts) => {
22
22
  if (IGNORE_PROPS_PARAMS.includes(v)) return;
23
23
  let execProps;
24
24
  try {
25
- execProps = exec(v, element);
25
+ execProps = exec(v, element, element.state, element.context, opts);
26
26
  } catch (e) {
27
27
  element.error(e, opts);
28
28
  }
@@ -33,7 +33,10 @@ const syncProps = async (props, element, opts) => {
33
33
  );
34
34
  });
35
35
  element.props = mergedProps;
36
- const methods = { update: await update.bind(element.props), __element: element };
36
+ const methods = {
37
+ update: await update.bind(element.props),
38
+ __element: element
39
+ };
37
40
  Object.setPrototypeOf(element.props, methods);
38
41
  return element.props;
39
42
  };
@@ -43,7 +46,7 @@ const createProps = function(element, parent, options) {
43
46
  const propsStack = options.cachedProps || createPropsStack(element, parent);
44
47
  if (propsStack.length) {
45
48
  ref.__props = propsStack;
46
- syncProps(propsStack, element);
49
+ syncProps(propsStack, element, options);
47
50
  } else {
48
51
  ref.__props = options.cachedProps || [];
49
52
  element.props = {};
@@ -56,7 +59,7 @@ const createProps = function(element, parent, options) {
56
59
  } catch (e) {
57
60
  element.props = {};
58
61
  ref.__props = options.cachedProps || [];
59
- element.error("Error applying props", e);
62
+ element.error("Error applying props", e, options);
60
63
  }
61
64
  }
62
65
  const methods = { update: update.bind(element.props), __element: element };
@@ -1,12 +1,13 @@
1
1
  import { syncProps } from "./create.js";
2
2
  import { inheritParentProps } from "./inherit.js";
3
- const updateProps = (newProps, element, parent) => {
3
+ const updateProps = (newProps, element, parent, opts) => {
4
4
  const { __ref } = element;
5
5
  let propsStack = __ref.__props;
6
6
  const parentProps = inheritParentProps(element, parent);
7
- if (parentProps.length) propsStack = __ref.__props = [].concat(parentProps, propsStack);
7
+ if (parentProps.length)
8
+ propsStack = __ref.__props = [].concat(parentProps, propsStack);
8
9
  if (newProps) propsStack = __ref.__props = [].concat(newProps, propsStack);
9
- if (propsStack) syncProps(propsStack, element);
10
+ if (propsStack) syncProps(propsStack, element, opts);
10
11
  return element;
11
12
  };
12
13
  export {
package/dist/esm/set.js CHANGED
@@ -26,14 +26,34 @@ const reset = async (options) => {
26
26
  const set = async function(params, options = {}, el) {
27
27
  var _a, _b, _c;
28
28
  const element = el || this;
29
+ const { __ref: ref } = element;
30
+ console.warn(params);
29
31
  if (options.preventContentUpdate || options.preventUpdate && ((_b = (_a = options.preventUpdate).includes) == null ? void 0 : _b.call(_a, "content")))
30
32
  return;
31
33
  if (options.routerContentElement && options.lastElement) {
32
34
  if (options.routerContentElement !== options.lastElement.content) return;
33
35
  }
36
+ const contentKey = setContentKey(element, options);
37
+ const content = element[contentKey];
38
+ const __contentRef = content && content.__ref;
34
39
  const lazyLoad = element.props && element.props.lazyLoad;
35
40
  const hasCollection = element.$collection || element.$stateCollection || element.$propsCollection;
36
41
  if (options.preventContentUpdate === true && !hasCollection) return;
42
+ if (ref.__noCollectionDifference || __contentRef && __contentRef.__cached && deepContains(params, content)) {
43
+ if (!options.preventBeforeUpdateListener && !options.preventListeners) {
44
+ const beforeUpdateReturns = await triggerEventOnUpdate(
45
+ "beforeUpdate",
46
+ params,
47
+ element,
48
+ options
49
+ );
50
+ if (beforeUpdateReturns === false) return element;
51
+ }
52
+ if (content == null ? void 0 : content.update) await content.update();
53
+ if (!options.preventUpdateListener)
54
+ await triggerEventOn("update", element, options);
55
+ return;
56
+ }
37
57
  if (params) {
38
58
  let { childExtend, props } = params;
39
59
  if (!props) props = params.props = {};
@@ -74,7 +74,7 @@ const update = async function(params = {}, opts) {
74
74
  const hasParentProps = parent.props && (parent.props[key] || parent.props.childProps);
75
75
  const hasFunctionInProps = ref.__props.filter((v) => isFunction(v));
76
76
  const props = params.props || hasParentProps || hasFunctionInProps.length;
77
- if (props) updateProps(props, element, parent);
77
+ if (props) updateProps(props, element, parent, options);
78
78
  }
79
79
  if (!options.preventBeforeUpdateListener && !options.preventListeners) {
80
80
  const beforeUpdateReturns = await triggerEventOnUpdate(
@@ -86,9 +86,9 @@ const update = async function(params = {}, opts) {
86
86
  if (beforeUpdateReturns === false) return element;
87
87
  }
88
88
  overwriteDeep(element, params, { exclude: METHODS_EXL });
89
- throughExecProps(element);
89
+ throughExecProps(element, options);
90
90
  await throughUpdatedExec(element, { ignore: UPDATE_DEFAULT_OPTIONS });
91
- await throughUpdatedDefine(element);
91
+ await throughUpdatedDefine(element, options);
92
92
  if (!options.isForced && !options.preventListeners) {
93
93
  await triggerEventOn("beforeClassAssign", element, options);
94
94
  }
@@ -2,7 +2,13 @@ import { exec, isFunction } from "@domql/utils";
2
2
  import { REGISTRY } from "../mixins/index.js";
3
3
  const applyParam = async (param, element, options) => {
4
4
  const { node, context, __ref: ref } = element;
5
- const prop = await exec(element[param], element);
5
+ const prop = await exec(
6
+ element[param],
7
+ element,
8
+ element.state,
9
+ element.context,
10
+ options
11
+ );
6
12
  const { onlyUpdate } = options;
7
13
  const DOMQLProperty = REGISTRY[param];
8
14
  const DOMQLPropertyFromContext = context && context.registry && context.registry[param];
package/iterate.js CHANGED
@@ -65,7 +65,7 @@ export const throughUpdatedExec = async (
65
65
  return changes
66
66
  }
67
67
 
68
- export const throughExecProps = (element) => {
68
+ export const throughExecProps = (element, opts) => {
69
69
  const { __ref: ref } = element
70
70
  const { props } = element
71
71
  for (const k in props) {
@@ -75,15 +75,21 @@ export const throughExecProps = (element) => {
75
75
  return warn.call(element, 'Element was not initiated to execute props')
76
76
  const cachedExecProp = ref.__execProps[k]
77
77
  if (isFunction(cachedExecProp)) {
78
- props[k] = exec(cachedExecProp, element)
78
+ props[k] = exec(
79
+ cachedExecProp,
80
+ element,
81
+ element.state,
82
+ element.context,
83
+ opts
84
+ )
79
85
  } else if (isDefine && isFunction(props[k])) {
80
86
  ref.__execProps[k] = props[k]
81
- props[k] = exec(props[k], element)
87
+ props[k] = exec(props[k], element, element.state, element.context, opts)
82
88
  }
83
89
  }
84
90
  }
85
91
 
86
- export const throughInitialDefine = async (element) => {
92
+ export const throughInitialDefine = async (element, opts) => {
87
93
  const { define, context, __ref: ref } = element
88
94
 
89
95
  let defineObj = {}
@@ -100,7 +106,13 @@ export const throughInitialDefine = async (element) => {
100
106
  !isVariant(param)
101
107
  ) {
102
108
  ref.__exec[param] = elementProp
103
- const execParam = (elementProp = await exec(elementProp, element))
109
+ const execParam = (elementProp = await exec(
110
+ elementProp,
111
+ element,
112
+ element.state,
113
+ element.context,
114
+ opts
115
+ ))
104
116
 
105
117
  if (execParam) {
106
118
  elementProp = element[param] = execParam.parse
@@ -121,7 +133,7 @@ export const throughInitialDefine = async (element) => {
121
133
  return element
122
134
  }
123
135
 
124
- export const throughUpdatedDefine = async (element) => {
136
+ export const throughUpdatedDefine = async (element, opts) => {
125
137
  const { context, define, __ref: ref } = element
126
138
  const changes = {}
127
139
 
@@ -137,7 +149,13 @@ export const throughUpdatedDefine = async (element) => {
137
149
  element.state,
138
150
  element.context
139
151
  )
140
- const cached = await exec(ref.__defineCache[param], element)
152
+ const cached = await exec(
153
+ ref.__defineCache[param],
154
+ element,
155
+ element.state,
156
+ element.context,
157
+ opts
158
+ )
141
159
  const newExecParam = await obj[param](
142
160
  cached,
143
161
  element,
package/mixins/attr.js CHANGED
@@ -7,14 +7,20 @@ import { deepMerge } from '../utils/index.js'
7
7
  /**
8
8
  * Recursively add attributes to a DOM node
9
9
  */
10
- export function attr(params, element, node) {
10
+ export function attr(params, element, node, opts) {
11
11
  const { __ref: ref, props } = element
12
12
  const { __attr } = ref
13
13
  if (isNot('object')) report('HTMLInvalidAttr', params)
14
14
  if (params) {
15
15
  if (props.attr) deepMerge(params, props.attr)
16
16
  for (const attr in params) {
17
- const val = exec(params[attr], element)
17
+ const val = exec(
18
+ params[attr],
19
+ element,
20
+ element.state,
21
+ element.context,
22
+ opts
23
+ )
18
24
  // if (__attr[attr] === val) return
19
25
  if (
20
26
  val !== false &&
@@ -22,7 +28,10 @@ export function attr(params, element, node) {
22
28
  !isNull(val) &&
23
29
  node.setAttribute
24
30
  )
25
- node.setAttribute(attr, exec(val, element))
31
+ node.setAttribute(
32
+ attr,
33
+ exec(val, element, element.state, element.context, opts)
34
+ )
26
35
  else if (node.removeAttribute) node.removeAttribute(attr)
27
36
  __attr[attr] = val
28
37
  }
@@ -5,31 +5,36 @@ import { exec, isObject, isString } from '@domql/utils'
5
5
  export const assignKeyAsClassname = (element) => {
6
6
  const { key } = element
7
7
  if (element.class === true) element.class = key
8
- else if (!element.class && typeof key === 'string' && key.charAt(0) === '_' && key.charAt(1) !== '_') {
8
+ else if (
9
+ !element.class &&
10
+ typeof key === 'string' &&
11
+ key.charAt(0) === '_' &&
12
+ key.charAt(1) !== '_'
13
+ ) {
9
14
  element.class = key.slice(1)
10
15
  }
11
16
  }
12
17
 
13
18
  // stringifies class object
14
- export const classify = (obj, element) => {
19
+ export const classify = (obj, element, opts) => {
15
20
  let className = ''
16
21
  for (const item in obj) {
17
22
  const param = obj[item]
18
23
  if (typeof param === 'boolean' && param) className += ` ${item}`
19
24
  else if (typeof param === 'string') className += ` ${param}`
20
25
  else if (typeof param === 'function') {
21
- className += ` ${exec(param, element)}`
26
+ className += ` ${exec(param, element, element.state, element.context, opts)}`
22
27
  }
23
28
  }
24
29
  return className
25
30
  }
26
31
 
27
- export const classList = (params, element) => {
32
+ export const classList = (params, element, opts) => {
28
33
  if (!params) return
29
34
  const { key } = element
30
35
  if (params === true) params = element.class = { key }
31
36
  if (isString(params)) params = element.class = { default: params }
32
- if (isObject(params)) params = classify(params, element)
37
+ if (isObject(params)) params = classify(params, element, opts)
33
38
  // TODO: fails on string
34
39
  const className = params.replace(/\s+/g, ' ').trim()
35
40
  if (element.ref) element.ref.class = className // TODO: this check is NOT needed in new DOMQL
@@ -37,14 +42,14 @@ export const classList = (params, element) => {
37
42
  }
38
43
 
39
44
  // LEGACY (still needed in old domql)
40
- export const applyClassListOnNode = (params, element, node) => {
41
- const className = classList(params, element)
45
+ export const applyClassListOnNode = (params, element, node, opts) => {
46
+ const className = classList(params, element, opts)
42
47
  node.classList = className
43
48
  return className
44
49
  }
45
50
 
46
- export function applyClasslist (params, element, node) {
47
- applyClassListOnNode(params, element, node)
51
+ export function applyClasslist(params, element, node, opts) {
52
+ applyClassListOnNode(params, element, node, opts)
48
53
  }
49
54
 
50
55
  export default applyClasslist
package/mixins/html.js CHANGED
@@ -6,8 +6,10 @@ import { exec } from '@domql/utils'
6
6
  * Appends raw HTML as content
7
7
  * an original one as a child
8
8
  */
9
- export function html (param, element, node) {
10
- const prop = exec(param, element) || exec(element?.props?.html, element)
9
+ export function html(param, element, node, opts) {
10
+ const prop =
11
+ exec(param, element, element.state, element.context, opts) ||
12
+ exec(element?.props?.html, element, element.state, element.context, opts)
11
13
  const { __ref } = element
12
14
  if (prop !== __ref.__html) {
13
15
  // const parser = new window.DOMParser()
package/mixins/state.js CHANGED
@@ -3,8 +3,8 @@
3
3
  import { IGNORE_STATE_PARAMS } from '@domql/state'
4
4
  import { exec, isObject } from '@domql/utils'
5
5
 
6
- export async function state (params, element, node) {
7
- const state = exec(params, element)
6
+ export async function state(params, element, node, opts) {
7
+ const state = exec(params, element, element.state, element.context, opts)
8
8
 
9
9
  if (isObject(state)) {
10
10
  for (const param in state) {
package/mixins/text.js CHANGED
@@ -1,17 +1,14 @@
1
1
  'use strict'
2
2
 
3
3
  import { create } from '../create.js'
4
- import {
5
- exec,
6
- isString
7
- } from '@domql/utils'
4
+ import { exec, isString } from '@domql/utils'
8
5
 
9
6
  /**
10
7
  * Creates a text node and appends into
11
8
  * an original one as a child
12
9
  */
13
- export function text (param, element, node) {
14
- let prop = exec(param, element)
10
+ export function text(param, element, node, opts) {
11
+ let prop = exec(param, element, element.state, element.context, opts)
15
12
  if (isString(prop) && prop.includes('{{')) {
16
13
  prop = element.call('replaceLiteralsWithObjectFields', prop)
17
14
  }
package/node.js CHANGED
@@ -20,7 +20,7 @@ import {
20
20
  import { REGISTRY } from './mixins/index.js'
21
21
  import { applyParam } from './utils/applyParam.js'
22
22
  import { propagateEventsFromProps } from './utils/propEvents.js'
23
- import { isNotProduction } from '@domql/utils/env.js'
23
+ // import { isNotProduction } from '@domql/utils/env.js'
24
24
  // import { defineSetter } from './methods'
25
25
 
26
26
  export const createNode = async (element, options) => {
@@ -54,10 +54,10 @@ export const createNode = async (element, options) => {
54
54
  // }
55
55
 
56
56
  // iterate through exec props
57
- throughExecProps(element)
57
+ throughExecProps(element, options)
58
58
 
59
59
  // iterate through define
60
- await throughInitialDefine(element)
60
+ await throughInitialDefine(element, options)
61
61
 
62
62
  // iterate through exec
63
63
  await throughInitialExec(element)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/element",
3
- "version": "2.31.37",
3
+ "version": "2.32.0",
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.31.37",
31
- "@domql/render": "^2.31.37",
32
- "@domql/state": "^2.31.37",
33
- "@domql/utils": "^2.31.37"
30
+ "@domql/event": "^2.32.0",
31
+ "@domql/render": "^2.32.0",
32
+ "@domql/state": "^2.32.0",
33
+ "@domql/utils": "^2.32.0"
34
34
  },
35
- "gitHead": "4a0a9c683f742b8d81fe3c8c4022939b93058971",
35
+ "gitHead": "6f087b0fe036c41c8f7d620ed67c24d25e371cc6",
36
36
  "devDependencies": {
37
37
  "@babel/core": "^7.27.1"
38
38
  }
package/props/create.js CHANGED
@@ -7,14 +7,14 @@ import { inheritParentProps } from './inherit.js'
7
7
 
8
8
  const createPropsStack = (element, parent) => {
9
9
  const { props, __ref: ref } = element
10
- const propsStack = ref.__props = inheritParentProps(element, parent)
10
+ const propsStack = (ref.__props = inheritParentProps(element, parent))
11
11
 
12
12
  if (isObject(props)) propsStack.push(props)
13
13
  else if (props === 'inherit' && parent.props) propsStack.push(parent.props)
14
14
  else if (props) propsStack.push(props)
15
15
 
16
16
  if (isArray(ref.__extend)) {
17
- ref.__extend.forEach(extend => {
17
+ ref.__extend.forEach((extend) => {
18
18
  if (extend.props && extend.props !== props) propsStack.push(extend.props)
19
19
  })
20
20
  }
@@ -28,12 +28,14 @@ export const syncProps = async (props, element, opts) => {
28
28
  element.props = {}
29
29
  const mergedProps = {}
30
30
 
31
- props.forEach(v => {
31
+ props.forEach((v) => {
32
32
  if (IGNORE_PROPS_PARAMS.includes(v)) return
33
33
  let execProps
34
34
  try {
35
- execProps = exec(v, element)
36
- } catch (e) { element.error(e, opts) }
35
+ execProps = exec(v, element, element.state, element.context, opts)
36
+ } catch (e) {
37
+ element.error(e, opts)
38
+ }
37
39
  // TODO: check if this failing the function props merge
38
40
  // if (isObject(execProps) && execProps.__element) return
39
41
  // it was causing infinite loop at early days
@@ -45,7 +47,10 @@ export const syncProps = async (props, element, opts) => {
45
47
  })
46
48
  element.props = mergedProps
47
49
 
48
- const methods = { update: await update.bind(element.props), __element: element }
50
+ const methods = {
51
+ update: await update.bind(element.props),
52
+ __element: element
53
+ }
49
54
  Object.setPrototypeOf(element.props, methods)
50
55
 
51
56
  return element.props
@@ -58,7 +63,7 @@ export const createProps = function (element, parent, options) {
58
63
  const propsStack = options.cachedProps || createPropsStack(element, parent)
59
64
  if (propsStack.length) {
60
65
  ref.__props = propsStack
61
- syncProps(propsStack, element)
66
+ syncProps(propsStack, element, options)
62
67
  } else {
63
68
  ref.__props = options.cachedProps || []
64
69
  element.props = {}
@@ -72,7 +77,7 @@ export const createProps = function (element, parent, options) {
72
77
  } catch (e) {
73
78
  element.props = {}
74
79
  ref.__props = options.cachedProps || []
75
- element.error('Error applying props', e)
80
+ element.error('Error applying props', e, options)
76
81
  }
77
82
  }
78
83
 
@@ -82,7 +87,7 @@ export const createProps = function (element, parent, options) {
82
87
  return element
83
88
  }
84
89
 
85
- async function update (props, options) {
90
+ async function update(props, options) {
86
91
  const element = this.__element
87
92
  await element.update({ props }, options)
88
93
  }
package/props/update.js CHANGED
@@ -3,15 +3,16 @@
3
3
  import { syncProps } from './create.js'
4
4
  import { inheritParentProps } from './inherit.js'
5
5
 
6
- export const updateProps = (newProps, element, parent) => {
6
+ export const updateProps = (newProps, element, parent, opts) => {
7
7
  const { __ref } = element
8
8
  let propsStack = __ref.__props
9
9
 
10
10
  const parentProps = inheritParentProps(element, parent)
11
- if (parentProps.length) propsStack = __ref.__props = [].concat(parentProps, propsStack)
11
+ if (parentProps.length)
12
+ propsStack = __ref.__props = [].concat(parentProps, propsStack)
12
13
  if (newProps) propsStack = __ref.__props = [].concat(newProps, propsStack)
13
14
 
14
- if (propsStack) syncProps(propsStack, element)
15
+ if (propsStack) syncProps(propsStack, element, opts)
15
16
 
16
17
  return element
17
18
  }
package/set.js CHANGED
@@ -31,7 +31,9 @@ export const reset = async (options) => {
31
31
 
32
32
  export const set = async function (params, options = {}, el) {
33
33
  const element = el || this
34
- // const { __ref: ref } = element
34
+ const { __ref: ref } = element
35
+
36
+ console.warn(params)
35
37
 
36
38
  if (
37
39
  options.preventContentUpdate ||
@@ -43,9 +45,9 @@ export const set = async function (params, options = {}, el) {
43
45
  if (options.routerContentElement !== options.lastElement.content) return
44
46
  }
45
47
 
46
- // const contentKey = setContentKey(element, options)
47
- // const content = element[contentKey]
48
- // const __contentRef = content && content.__ref
48
+ const contentKey = setContentKey(element, options)
49
+ const content = element[contentKey]
50
+ const __contentRef = content && content.__ref
49
51
  const lazyLoad = element.props && element.props.lazyLoad
50
52
 
51
53
  const hasCollection =
@@ -55,24 +57,24 @@ export const set = async function (params, options = {}, el) {
55
57
  // console.log(deepClone(params), deepClone(content))
56
58
  // console.log(deepContains(params, content))
57
59
 
58
- // if (
59
- // ref.__noCollectionDifference ||
60
- // (__contentRef && __contentRef.__cached && deepContains(params, content))
61
- // ) {
62
- // // if (!options.preventBeforeUpdateListener && !options.preventListeners) {
63
- // // const beforeUpdateReturns = await triggerEventOnUpdate(
64
- // // 'beforeUpdate',
65
- // // params,
66
- // // element,
67
- // // options
68
- // // )
69
- // // if (beforeUpdateReturns === false) return element
70
- // // }
71
- // // if (content?.update) await content.update()
72
- // // if (!options.preventUpdateListener)
73
- // // await triggerEventOn('update', element, options)
74
- // return
75
- // }
60
+ if (
61
+ ref.__noCollectionDifference ||
62
+ (__contentRef && __contentRef.__cached && deepContains(params, content))
63
+ ) {
64
+ if (!options.preventBeforeUpdateListener && !options.preventListeners) {
65
+ const beforeUpdateReturns = await triggerEventOnUpdate(
66
+ 'beforeUpdate',
67
+ params,
68
+ element,
69
+ options
70
+ )
71
+ if (beforeUpdateReturns === false) return element
72
+ }
73
+ if (content?.update) await content.update()
74
+ if (!options.preventUpdateListener)
75
+ await triggerEventOn('update', element, options)
76
+ return
77
+ }
76
78
 
77
79
  if (params) {
78
80
  let { childExtend, props } = params
package/update.js CHANGED
@@ -102,7 +102,7 @@ export const update = async function (params = {}, opts) {
102
102
  parent.props && (parent.props[key] || parent.props.childProps)
103
103
  const hasFunctionInProps = ref.__props.filter((v) => isFunction(v))
104
104
  const props = params.props || hasParentProps || hasFunctionInProps.length
105
- if (props) updateProps(props, element, parent)
105
+ if (props) updateProps(props, element, parent, options)
106
106
  }
107
107
 
108
108
  if (!options.preventBeforeUpdateListener && !options.preventListeners) {
@@ -119,9 +119,9 @@ export const update = async function (params = {}, opts) {
119
119
  overwriteDeep(element, params, { exclude: METHODS_EXL })
120
120
 
121
121
  // exec updates
122
- throughExecProps(element)
122
+ throughExecProps(element, options)
123
123
  await throughUpdatedExec(element, { ignore: UPDATE_DEFAULT_OPTIONS })
124
- await throughUpdatedDefine(element)
124
+ await throughUpdatedDefine(element, options)
125
125
 
126
126
  if (!options.isForced && !options.preventListeners) {
127
127
  await triggerEventOn('beforeClassAssign', element, options)
@@ -5,7 +5,13 @@ import { REGISTRY } from '../mixins/index.js'
5
5
 
6
6
  export const applyParam = async (param, element, options) => {
7
7
  const { node, context, __ref: ref } = element
8
- const prop = await exec(element[param], element)
8
+ const prop = await exec(
9
+ element[param],
10
+ element,
11
+ element.state,
12
+ element.context,
13
+ options
14
+ )
9
15
 
10
16
  const { onlyUpdate } = options
11
17