@domql/element 2.28.40 → 2.28.44

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
@@ -78,7 +78,7 @@ export const create = async (
78
78
  element.key = key
79
79
 
80
80
  if (options.onlyResolveExtends) {
81
- return onlyResolveExtends(element, parent, key, options)
81
+ return await onlyResolveExtends(element, parent, key, options)
82
82
  }
83
83
 
84
84
  await triggerEventOn('start', element, options)
@@ -386,7 +386,7 @@ const addCaching = (element, parent) => {
386
386
  // }
387
387
  }
388
388
 
389
- const onlyResolveExtends = (element, parent, key, options) => {
389
+ const onlyResolveExtends = async (element, parent, key, options) => {
390
390
  const { __ref: ref } = element
391
391
  if (!ref.__skipCreate) {
392
392
  addCaching(element, parent)
@@ -416,8 +416,8 @@ const onlyResolveExtends = (element, parent, key, options) => {
416
416
  }
417
417
 
418
418
  if (element.tag !== 'string' && element.tag !== 'fragment') {
419
- throughInitialDefine(element)
420
- throughInitialExec(element)
419
+ await throughInitialDefine(element)
420
+ await throughInitialExec(element)
421
421
 
422
422
  for (const k in element) {
423
423
  if (
@@ -55,7 +55,7 @@ const create = async (element, parent, key, options = import_options.OPTIONS.cre
55
55
  }
56
56
  element.key = key;
57
57
  if (options.onlyResolveExtends) {
58
- return onlyResolveExtends(element, parent, key, options);
58
+ return await onlyResolveExtends(element, parent, key, options);
59
59
  }
60
60
  await (0, import_event.triggerEventOn)("start", element, options);
61
61
  switchDefaultOptions(element, parent, options);
@@ -257,7 +257,7 @@ const addCaching = (element, parent) => {
257
257
  if (!parentRef.path) parentRef.path = [];
258
258
  ref.path = parentRef.path.concat(element.key);
259
259
  };
260
- const onlyResolveExtends = (element, parent, key, options) => {
260
+ const onlyResolveExtends = async (element, parent, key, options) => {
261
261
  const { __ref: ref } = element;
262
262
  if (!ref.__skipCreate) {
263
263
  addCaching(element, parent);
@@ -277,8 +277,8 @@ const onlyResolveExtends = (element, parent, key, options) => {
277
277
  addElementIntoParentChildren(element, parent);
278
278
  }
279
279
  if (element.tag !== "string" && element.tag !== "fragment") {
280
- (0, import_iterate.throughInitialDefine)(element);
281
- (0, import_iterate.throughInitialExec)(element);
280
+ await (0, import_iterate.throughInitialDefine)(element);
281
+ await (0, import_iterate.throughInitialExec)(element);
282
282
  for (const k in element) {
283
283
  if ((0, import_utils.isUndefined)(element[k]) || (0, import_methods.isMethod)(k, element) || (0, import_utils.isObject)((import_mixins.registry.default || import_mixins.registry)[k]) || (0, import_utils.isVariant)(k))
284
284
  continue;
@@ -28,25 +28,29 @@ module.exports = __toCommonJS(iterate_exports);
28
28
  var import_utils = require("@domql/utils");
29
29
  var import_utils2 = require("./utils/index.js");
30
30
  var import_methods = require("./methods/index.js");
31
- const throughInitialExec = (element, exclude = {}) => {
31
+ const throughInitialExec = async (element, exclude = {}) => {
32
32
  const { __ref: ref } = element;
33
33
  for (const param in element) {
34
34
  if (exclude[param]) continue;
35
35
  const prop = element[param];
36
36
  if ((0, import_utils.isFunction)(prop) && !(0, import_methods.isMethod)(param, element) && !(0, import_utils.isVariant)(param)) {
37
37
  ref.__exec[param] = prop;
38
- element[param] = prop(element, element.state, element.context);
38
+ element[param] = await prop(element, element.state, element.context);
39
39
  }
40
40
  }
41
41
  };
42
- const throughUpdatedExec = (element, options = { excludes: import_utils2.METHODS_EXL }) => {
42
+ const throughUpdatedExec = async (element, options = { excludes: import_utils2.METHODS_EXL }) => {
43
43
  const { __ref: ref } = element;
44
44
  const changes = {};
45
45
  for (const param in ref.__exec) {
46
46
  const prop = element[param];
47
47
  const isDefinedParam = ref.__defineCache[param];
48
48
  if (isDefinedParam) continue;
49
- const newExec = ref.__exec[param](element, element.state, element.context);
49
+ const newExec = await ref.__exec[param](
50
+ element,
51
+ element.state,
52
+ element.context
53
+ );
50
54
  const execReturnsString = (0, import_utils.isString)(newExec) || (0, import_utils.isNumber)(newExec);
51
55
  if (prop && prop.node && execReturnsString) {
52
56
  (0, import_utils2.overwrite)(prop, { text: newExec }, options);
@@ -76,7 +80,7 @@ const throughExecProps = (element) => {
76
80
  }
77
81
  }
78
82
  };
79
- const throughInitialDefine = (element) => {
83
+ const throughInitialDefine = async (element) => {
80
84
  const { define, context, __ref: ref } = element;
81
85
  let defineObj = {};
82
86
  const hasGlobalDefine = context && (0, import_utils.isObject)(context.define);
@@ -86,18 +90,23 @@ const throughInitialDefine = (element) => {
86
90
  let elementProp = element[param];
87
91
  if ((0, import_utils.isFunction)(elementProp) && !(0, import_methods.isMethod)(param, element) && !(0, import_utils.isVariant)(param)) {
88
92
  ref.__exec[param] = elementProp;
89
- const execParam2 = elementProp = (0, import_utils.exec)(elementProp, element);
93
+ const execParam2 = elementProp = await (0, import_utils.exec)(elementProp, element);
90
94
  if (execParam2) {
91
95
  elementProp = element[param] = execParam2.parse ? execParam2.parse() : execParam2;
92
96
  ref.__defineCache[param] = elementProp;
93
97
  }
94
98
  }
95
- const execParam = defineObj[param](elementProp, element, element.state, element.context);
99
+ const execParam = await defineObj[param](
100
+ elementProp,
101
+ element,
102
+ element.state,
103
+ element.context
104
+ );
96
105
  if (execParam) element[param] = execParam;
97
106
  }
98
107
  return element;
99
108
  };
100
- const throughUpdatedDefine = (element) => {
109
+ const throughUpdatedDefine = async (element) => {
101
110
  const { context, define, __ref: ref } = element;
102
111
  const changes = {};
103
112
  let obj = {};
@@ -105,9 +114,19 @@ const throughUpdatedDefine = (element) => {
105
114
  if ((0, import_utils.isObject)(context && context.define)) obj = { ...obj, ...context.define };
106
115
  for (const param in obj) {
107
116
  const execParam = ref.__exec[param];
108
- if (execParam) ref.__defineCache[param] = execParam(element, element.state, element.context);
109
- const cached = (0, import_utils.exec)(ref.__defineCache[param], element);
110
- const newExecParam = obj[param](cached, element, element.state, element.context);
117
+ if (execParam)
118
+ ref.__defineCache[param] = await execParam(
119
+ element,
120
+ element.state,
121
+ element.context
122
+ );
123
+ const cached = await (0, import_utils.exec)(ref.__defineCache[param], element);
124
+ const newExecParam = await obj[param](
125
+ cached,
126
+ element,
127
+ element.state,
128
+ element.context
129
+ );
111
130
  if (newExecParam) element[param] = newExecParam;
112
131
  }
113
132
  return changes;
@@ -23,6 +23,7 @@ __export(methods_exports, {
23
23
  defineSetter: () => defineSetter,
24
24
  error: () => error,
25
25
  get: () => get,
26
+ getChildren: () => getChildren,
26
27
  getPath: () => getPath,
27
28
  getRef: () => getRef,
28
29
  isMethod: () => isMethod,
@@ -156,9 +157,14 @@ function setProps(param, options) {
156
157
  element.update({ props: param }, options);
157
158
  return element;
158
159
  }
159
- function getRef() {
160
+ function getRef(key) {
161
+ if (key) return this.__ref && this.__ref[key];
160
162
  return this.__ref;
161
163
  }
164
+ function getChildren() {
165
+ const __children = this.getRef("__children");
166
+ return __children.map((k) => this[k]);
167
+ }
162
168
  function getPath() {
163
169
  return this.getRef().path;
164
170
  }
@@ -315,6 +321,7 @@ const METHODS = [
315
321
  "lookdown",
316
322
  "lookdownAll",
317
323
  "getRef",
324
+ "getChildren",
318
325
  "getPath",
319
326
  "setNodeStyles",
320
327
  "spotByPath",
package/dist/cjs/node.js CHANGED
@@ -48,8 +48,8 @@ const createNode = async (element, options) => {
48
48
  if ((0, import_utils.isFunction)(node.setAttribute)) node.setAttribute("key", element.key);
49
49
  }
50
50
  (0, import_iterate.throughExecProps)(element);
51
- (0, import_iterate.throughInitialDefine)(element);
52
- (0, import_iterate.throughInitialExec)(element);
51
+ await (0, import_iterate.throughInitialDefine)(element);
52
+ await (0, import_iterate.throughInitialExec)(element);
53
53
  if (element.tag !== "string" && element.tag !== "fragment") {
54
54
  (0, import_propEvents.propagateEventsFromProps)(element);
55
55
  if (isNewNode && (0, import_utils.isObject)(element.on)) {
@@ -46,17 +46,25 @@ const UPDATE_DEFAULT_OPTIONS = {
46
46
  };
47
47
  const update = async function(params = {}, opts) {
48
48
  const calleeElementCache = opts == null ? void 0 : opts.calleeElement;
49
- const options = (0, import_utils.deepClone)((0, import_utils.isObject)(opts) ? (0, import_utils2.deepMerge)(opts, UPDATE_DEFAULT_OPTIONS) : UPDATE_DEFAULT_OPTIONS, { exclude: ["calleeElement"] });
49
+ const options = (0, import_utils.deepClone)(
50
+ (0, import_utils.isObject)(opts) ? (0, import_utils2.deepMerge)(opts, UPDATE_DEFAULT_OPTIONS) : UPDATE_DEFAULT_OPTIONS,
51
+ { exclude: ["calleeElement"] }
52
+ );
50
53
  options.calleeElement = calleeElementCache;
51
54
  const element = this;
52
55
  const { parent, node, key } = element;
53
56
  const { excludes, preventInheritAtCurrentState } = options;
54
57
  let ref = element.__ref;
55
58
  if (!ref) ref = element.__ref = {};
56
- const [snapshotOnCallee, calleeElement, snapshotHasUpdated] = captureSnapshot(element, options);
59
+ const [snapshotOnCallee, calleeElement, snapshotHasUpdated] = captureSnapshot(
60
+ element,
61
+ options
62
+ );
57
63
  if (snapshotHasUpdated) return;
58
- if (!options.preventListeners) await (0, import_event.triggerEventOnUpdate)("startUpdate", params, element, options);
59
- if (preventInheritAtCurrentState && preventInheritAtCurrentState.__element === element) return;
64
+ if (!options.preventListeners)
65
+ await (0, import_event.triggerEventOnUpdate)("startUpdate", params, element, options);
66
+ if (preventInheritAtCurrentState && preventInheritAtCurrentState.__element === element)
67
+ return;
60
68
  if (!excludes) (0, import_utils.merge)(options, UPDATE_DEFAULT_OPTIONS);
61
69
  if ((0, import_utils.isString)(params) || (0, import_utils.isNumber)(params)) {
62
70
  params = { text: params };
@@ -72,13 +80,18 @@ const update = async function(params = {}, opts) {
72
80
  if (props) (0, import_props.updateProps)(props, element, parent);
73
81
  }
74
82
  if (!options.preventBeforeUpdateListener && !options.preventListeners) {
75
- const beforeUpdateReturns = await (0, import_event.triggerEventOnUpdate)("beforeUpdate", params, element, options);
83
+ const beforeUpdateReturns = await (0, import_event.triggerEventOnUpdate)(
84
+ "beforeUpdate",
85
+ params,
86
+ element,
87
+ options
88
+ );
76
89
  if (beforeUpdateReturns === false) return element;
77
90
  }
78
91
  (0, import_utils.overwriteDeep)(element, params, { exclude: import_utils2.METHODS_EXL });
79
92
  (0, import_iterate.throughExecProps)(element);
80
- (0, import_iterate.throughUpdatedExec)(element, { ignore: UPDATE_DEFAULT_OPTIONS });
81
- (0, import_iterate.throughUpdatedDefine)(element);
93
+ await (0, import_iterate.throughUpdatedExec)(element, { ignore: UPDATE_DEFAULT_OPTIONS });
94
+ await (0, import_iterate.throughUpdatedDefine)(element);
82
95
  if (!options.isForced && !options.preventListeners) {
83
96
  await (0, import_event.triggerEventOn)("beforeClassAssign", element, options);
84
97
  }
@@ -97,8 +110,10 @@ const update = async function(params = {}, opts) {
97
110
  preventUpdateAfterCount
98
111
  } = options;
99
112
  if (preventUpdateAfter) {
100
- if ((0, import_utils.isNumber)(preventUpdateAfterCount) && preventUpdateAfter <= preventUpdateAfterCount) return;
101
- else if (options.preventUpdateAfterCount === void 0) options.preventUpdateAfterCount = 1;
113
+ if ((0, import_utils.isNumber)(preventUpdateAfterCount) && preventUpdateAfter <= preventUpdateAfterCount)
114
+ return;
115
+ else if (options.preventUpdateAfterCount === void 0)
116
+ options.preventUpdateAfterCount = 1;
102
117
  else options.preventUpdateAfterCount++;
103
118
  }
104
119
  for (const param in element) {
@@ -107,7 +122,8 @@ const update = async function(params = {}, opts) {
107
122
  const isInPreventUpdate = (0, import_utils.isArray)(preventUpdate) && preventUpdate.includes(param);
108
123
  const isInPreventDefineUpdate = (0, import_utils.isArray)(preventDefineUpdate) && preventDefineUpdate.includes(param);
109
124
  const hasCollection = element.$collection || element.$stateCollection || element.$propsCollection;
110
- if ((0, import_utils.isUndefined)(prop) || isInPreventUpdate || isInPreventDefineUpdate || preventDefineUpdate === true || preventDefineUpdate === param || preventContentUpdate && param === "content" && !hasCollection || (preventStateUpdate && param) === "state" || (0, import_methods.isMethod)(param, element) || (0, import_utils.isObject)(import_mixins.REGISTRY[param]) || (0, import_utils.isVariant)(param)) continue;
125
+ if ((0, import_utils.isUndefined)(prop) || isInPreventUpdate || isInPreventDefineUpdate || preventDefineUpdate === true || preventDefineUpdate === param || preventContentUpdate && param === "content" && !hasCollection || (preventStateUpdate && param) === "state" || (0, import_methods.isMethod)(param, element) || (0, import_utils.isObject)(import_mixins.REGISTRY[param]) || (0, import_utils.isVariant)(param))
126
+ continue;
111
127
  if (preventStateUpdate === "once") options.preventStateUpdate = false;
112
128
  const isElement = await (0, import_applyParam.applyParam)(param, element, options);
113
129
  if (isElement) {
@@ -150,9 +166,15 @@ const captureSnapshot = (element, options) => {
150
166
  };
151
167
  const checkIfOnUpdate = (element, parent, options) => {
152
168
  var _a, _b, _c;
153
- if (!(0, import_utils.isFunction)(element.if) && !(0, import_utils.isFunction)((_a = element.props) == null ? void 0 : _a.if) || !parent) return;
169
+ if (!(0, import_utils.isFunction)(element.if) && !(0, import_utils.isFunction)((_a = element.props) == null ? void 0 : _a.if) || !parent)
170
+ return;
154
171
  const ref = element.__ref;
155
- const ifPassed = (element.if || ((_b = element.props) == null ? void 0 : _b.if))(element, element.state, element.context, options);
172
+ const ifPassed = (element.if || ((_b = element.props) == null ? void 0 : _b.if))(
173
+ element,
174
+ element.state,
175
+ element.context,
176
+ options
177
+ );
156
178
  const itWasFalse = ref.__if !== true;
157
179
  if (ifPassed) {
158
180
  ref.__if = true;
@@ -175,7 +197,8 @@ const checkIfOnUpdate = (element, parent, options) => {
175
197
  const contentKey = ref.contentElementKey;
176
198
  if (element.$collection || element.$stateCollection || element.$propsCollection) {
177
199
  element.removeContent();
178
- } else if ((_c = element[contentKey]) == null ? void 0 : _c.parseDeep) element[contentKey] = element[contentKey].parseDeep();
200
+ } else if ((_c = element[contentKey]) == null ? void 0 : _c.parseDeep)
201
+ element[contentKey] = element[contentKey].parseDeep();
179
202
  const previousElement = element.previousElement();
180
203
  const previousNode = previousElement == null ? void 0 : previousElement.node;
181
204
  const hasPrevious = previousNode == null ? void 0 : previousNode.parentNode;
@@ -188,7 +211,13 @@ const checkIfOnUpdate = (element, parent, options) => {
188
211
  };
189
212
  delete element.__ref;
190
213
  delete element.parent;
191
- const createdElement = (0, import_create.create)(element, parent, element.key, import_options.OPTIONS.create, attachOptions);
214
+ const createdElement = (0, import_create.create)(
215
+ element,
216
+ parent,
217
+ element.key,
218
+ import_options.OPTIONS.create,
219
+ attachOptions
220
+ );
192
221
  if (options.preventUpdate !== true && element.on && (0, import_utils.isFunction)(element.on.update)) {
193
222
  (0, import_event.applyEvent)(element.on.update, createdElement, createdElement.state);
194
223
  }
@@ -212,18 +241,33 @@ const inheritStateUpdates = async (element, options) => {
212
241
  const shouldForceFunctionState = (0, import_utils.isFunction)(stateKey) && !isHoisted && execStateFunction;
213
242
  if (shouldForceFunctionState) {
214
243
  const execState = (0, import_utils.exec)(stateKey, element);
215
- state.set(execState, { ...options, preventUpdate: true, preventStateUpdateListener: false, updatedByStateFunction: true });
244
+ state.set(execState, {
245
+ ...options,
246
+ preventUpdate: true,
247
+ preventStateUpdateListener: false,
248
+ updatedByStateFunction: true
249
+ });
216
250
  return;
217
251
  }
218
252
  const keyInParentState = (0, import_state.findInheritedState)(element, element.parent);
219
253
  if (!keyInParentState || options.preventInheritedStateUpdate) return;
220
254
  if (!options.preventBeforeStateUpdateListener && !options.preventListeners) {
221
- const initStateReturns = await (0, import_event.triggerEventOnUpdate)("beforeStateUpdate", keyInParentState, element, options);
255
+ const initStateReturns = await (0, import_event.triggerEventOnUpdate)(
256
+ "beforeStateUpdate",
257
+ keyInParentState,
258
+ element,
259
+ options
260
+ );
222
261
  if (initStateReturns === false) return element;
223
262
  }
224
263
  const newState = await createStateUpdate(element, parent, options);
225
264
  if (!options.preventStateUpdateListener && !options.preventListeners) {
226
- await (0, import_event.triggerEventOnUpdate)("stateUpdate", newState.parse(), element, options);
265
+ await (0, import_event.triggerEventOnUpdate)(
266
+ "stateUpdate",
267
+ newState.parse(),
268
+ element,
269
+ options
270
+ );
227
271
  }
228
272
  };
229
273
  const createStateUpdate = async (element, parent, options) => {
@@ -51,7 +51,7 @@ const create = async (element, parent, key, options = OPTIONS.create || {}, atta
51
51
  }
52
52
  element.key = key;
53
53
  if (options.onlyResolveExtends) {
54
- return onlyResolveExtends(element, parent, key, options);
54
+ return await onlyResolveExtends(element, parent, key, options);
55
55
  }
56
56
  await triggerEventOn("start", element, options);
57
57
  switchDefaultOptions(element, parent, options);
@@ -253,7 +253,7 @@ const addCaching = (element, parent) => {
253
253
  if (!parentRef.path) parentRef.path = [];
254
254
  ref.path = parentRef.path.concat(element.key);
255
255
  };
256
- const onlyResolveExtends = (element, parent, key, options) => {
256
+ const onlyResolveExtends = async (element, parent, key, options) => {
257
257
  const { __ref: ref } = element;
258
258
  if (!ref.__skipCreate) {
259
259
  addCaching(element, parent);
@@ -273,8 +273,8 @@ const onlyResolveExtends = (element, parent, key, options) => {
273
273
  addElementIntoParentChildren(element, parent);
274
274
  }
275
275
  if (element.tag !== "string" && element.tag !== "fragment") {
276
- throughInitialDefine(element);
277
- throughInitialExec(element);
276
+ await throughInitialDefine(element);
277
+ await throughInitialExec(element);
278
278
  for (const k in element) {
279
279
  if (isUndefined(element[k]) || isMethod(k, element) || isObject((registry.default || registry)[k]) || isVariant(k))
280
280
  continue;
@@ -10,25 +10,29 @@ import {
10
10
  } from "@domql/utils";
11
11
  import { METHODS_EXL, overwrite } from "./utils/index.js";
12
12
  import { isMethod } from "./methods/index.js";
13
- const throughInitialExec = (element, exclude = {}) => {
13
+ const throughInitialExec = async (element, exclude = {}) => {
14
14
  const { __ref: ref } = element;
15
15
  for (const param in element) {
16
16
  if (exclude[param]) continue;
17
17
  const prop = element[param];
18
18
  if (isFunction(prop) && !isMethod(param, element) && !isVariant(param)) {
19
19
  ref.__exec[param] = prop;
20
- element[param] = prop(element, element.state, element.context);
20
+ element[param] = await prop(element, element.state, element.context);
21
21
  }
22
22
  }
23
23
  };
24
- const throughUpdatedExec = (element, options = { excludes: METHODS_EXL }) => {
24
+ const throughUpdatedExec = async (element, options = { excludes: METHODS_EXL }) => {
25
25
  const { __ref: ref } = element;
26
26
  const changes = {};
27
27
  for (const param in ref.__exec) {
28
28
  const prop = element[param];
29
29
  const isDefinedParam = ref.__defineCache[param];
30
30
  if (isDefinedParam) continue;
31
- const newExec = ref.__exec[param](element, element.state, element.context);
31
+ const newExec = await ref.__exec[param](
32
+ element,
33
+ element.state,
34
+ element.context
35
+ );
32
36
  const execReturnsString = isString(newExec) || isNumber(newExec);
33
37
  if (prop && prop.node && execReturnsString) {
34
38
  overwrite(prop, { text: newExec }, options);
@@ -58,7 +62,7 @@ const throughExecProps = (element) => {
58
62
  }
59
63
  }
60
64
  };
61
- const throughInitialDefine = (element) => {
65
+ const throughInitialDefine = async (element) => {
62
66
  const { define, context, __ref: ref } = element;
63
67
  let defineObj = {};
64
68
  const hasGlobalDefine = context && isObject(context.define);
@@ -68,18 +72,23 @@ const throughInitialDefine = (element) => {
68
72
  let elementProp = element[param];
69
73
  if (isFunction(elementProp) && !isMethod(param, element) && !isVariant(param)) {
70
74
  ref.__exec[param] = elementProp;
71
- const execParam2 = elementProp = exec(elementProp, element);
75
+ const execParam2 = elementProp = await exec(elementProp, element);
72
76
  if (execParam2) {
73
77
  elementProp = element[param] = execParam2.parse ? execParam2.parse() : execParam2;
74
78
  ref.__defineCache[param] = elementProp;
75
79
  }
76
80
  }
77
- const execParam = defineObj[param](elementProp, element, element.state, element.context);
81
+ const execParam = await defineObj[param](
82
+ elementProp,
83
+ element,
84
+ element.state,
85
+ element.context
86
+ );
78
87
  if (execParam) element[param] = execParam;
79
88
  }
80
89
  return element;
81
90
  };
82
- const throughUpdatedDefine = (element) => {
91
+ const throughUpdatedDefine = async (element) => {
83
92
  const { context, define, __ref: ref } = element;
84
93
  const changes = {};
85
94
  let obj = {};
@@ -87,9 +96,19 @@ const throughUpdatedDefine = (element) => {
87
96
  if (isObject(context && context.define)) obj = { ...obj, ...context.define };
88
97
  for (const param in obj) {
89
98
  const execParam = ref.__exec[param];
90
- if (execParam) ref.__defineCache[param] = execParam(element, element.state, element.context);
91
- const cached = exec(ref.__defineCache[param], element);
92
- const newExecParam = obj[param](cached, element, element.state, element.context);
99
+ if (execParam)
100
+ ref.__defineCache[param] = await execParam(
101
+ element,
102
+ element.state,
103
+ element.context
104
+ );
105
+ const cached = await exec(ref.__defineCache[param], element);
106
+ const newExecParam = await obj[param](
107
+ cached,
108
+ element,
109
+ element.state,
110
+ element.context
111
+ );
93
112
  if (newExecParam) element[param] = newExecParam;
94
113
  }
95
114
  return changes;
@@ -119,9 +119,14 @@ function setProps(param, options) {
119
119
  element.update({ props: param }, options);
120
120
  return element;
121
121
  }
122
- function getRef() {
122
+ function getRef(key) {
123
+ if (key) return this.__ref && this.__ref[key];
123
124
  return this.__ref;
124
125
  }
126
+ function getChildren() {
127
+ const __children = this.getRef("__children");
128
+ return __children.map((k) => this[k]);
129
+ }
125
130
  function getPath() {
126
131
  return this.getRef().path;
127
132
  }
@@ -278,6 +283,7 @@ const METHODS = [
278
283
  "lookdown",
279
284
  "lookdownAll",
280
285
  "getRef",
286
+ "getChildren",
281
287
  "getPath",
282
288
  "setNodeStyles",
283
289
  "spotByPath",
@@ -305,6 +311,7 @@ export {
305
311
  defineSetter,
306
312
  error,
307
313
  get,
314
+ getChildren,
308
315
  getPath,
309
316
  getRef,
310
317
  isMethod,
package/dist/esm/node.js CHANGED
@@ -34,8 +34,8 @@ const createNode = async (element, options) => {
34
34
  if (isFunction(node.setAttribute)) node.setAttribute("key", element.key);
35
35
  }
36
36
  throughExecProps(element);
37
- throughInitialDefine(element);
38
- throughInitialExec(element);
37
+ await throughInitialDefine(element);
38
+ await throughInitialExec(element);
39
39
  if (element.tag !== "string" && element.tag !== "fragment") {
40
40
  propagateEventsFromProps(element);
41
41
  if (isNewNode && isObject(element.on)) {