@domql/element 2.33.26 → 2.33.28

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
@@ -125,6 +125,8 @@ export const create = async (
125
125
 
126
126
  const onInit = await triggerEventOn('init', element, options)
127
127
  if (onInit === false) return element
128
+ const onEventInit = await triggerEventOn('eventInit', element, options)
129
+ if (onEventInit === false) return element
128
130
 
129
131
  await triggerEventOn('beforeClassAssign', element, options)
130
132
 
@@ -433,11 +435,8 @@ const createScope = (element, parent) => {
433
435
 
434
436
  const createIfConditionFlag = (element, parent) => {
435
437
  const { __ref: ref } = element
436
-
437
- if (
438
- isFunction(element.if) &&
439
- !element.if(element, element.state, element.context)
440
- ) {
438
+ const ifFn = element.props?.if || element.if
439
+ if (isFunction(ifFn) && !ifFn(element, element.state, element.context)) {
441
440
  delete ref.__if
442
441
  } else ref.__if = true
443
442
  }
@@ -87,6 +87,8 @@ const create = async (element, parent2, key, options = import_options.OPTIONS.cr
87
87
  (0, import_utils.addChildrenIfNotInOriginal)(element, parent2, key);
88
88
  const onInit = await (0, import_event.triggerEventOn)("init", element, options);
89
89
  if (onInit === false) return element;
90
+ const onEventInit = await (0, import_event.triggerEventOn)("eventInit", element, options);
91
+ if (onEventInit === false) return element;
90
92
  await (0, import_event.triggerEventOn)("beforeClassAssign", element, options);
91
93
  (0, import_classList.assignKeyAsClassname)(element);
92
94
  await renderElement(element, parent2, options, attachOptions);
@@ -299,8 +301,10 @@ const createScope = (element, parent2) => {
299
301
  if (!element.scope) element.scope = parent2.scope || ref.root.scope || {};
300
302
  };
301
303
  const createIfConditionFlag = (element, parent2) => {
304
+ var _a;
302
305
  const { __ref: ref } = element;
303
- if ((0, import_utils.isFunction)(element.if) && !element.if(element, element.state, element.context)) {
306
+ const ifFn = ((_a = element.props) == null ? void 0 : _a.if) || element.if;
307
+ if ((0, import_utils.isFunction)(ifFn) && !ifFn(element, element.state, element.context)) {
304
308
  delete ref.__if;
305
309
  } else ref.__if = true;
306
310
  };
package/dist/cjs/set.js CHANGED
@@ -86,12 +86,16 @@ const set = async function(params, options = {}, el) {
86
86
  return;
87
87
  }
88
88
  if (params) {
89
- let { childExtend, props } = params;
89
+ let { childExtend, childExtendRecursive, props } = params;
90
90
  if (!props) props = params.props = {};
91
91
  if (!childExtend && element.childExtend) {
92
92
  params.childExtend = element.childExtend;
93
93
  props.ignoreChildExtend = true;
94
94
  }
95
+ if (!childExtendRecursive && element.childExtendRecursive) {
96
+ params.childExtendRecursive = element.childExtendRecursive;
97
+ props.ignoreChildExtendRecursive = true;
98
+ }
95
99
  if (!(props == null ? void 0 : props.childProps) && ((_d = element.props) == null ? void 0 : _d.childProps)) {
96
100
  props.childProps = element.props.childProps;
97
101
  props.ignoreChildProps = true;
@@ -200,16 +200,11 @@ const captureSnapshot = (element, options) => {
200
200
  return [snapshotOnCallee, calleeElement];
201
201
  };
202
202
  const checkIfOnUpdate = (element, parent, options) => {
203
- var _a, _b, _c;
204
- if (!(0, import_utils.isFunction)(element.if) && !(0, import_utils.isFunction)((_a = element.props) == null ? void 0 : _a.if) || !parent)
205
- return;
203
+ var _a, _b;
204
+ const ifFn = ((_a = element.props) == null ? void 0 : _a.if) || element.if;
205
+ if (!(0, import_utils.isFunction)(ifFn) || !parent) return;
206
206
  const ref = element.__ref;
207
- const ifPassed = (element.if || ((_b = element.props) == null ? void 0 : _b.if))(
208
- element,
209
- element.state,
210
- element.context,
211
- options
212
- );
207
+ const ifPassed = ifFn(element, element.state, element.context, options);
213
208
  const itWasFalse = ref.__if !== true;
214
209
  if (ifPassed) {
215
210
  ref.__if = true;
@@ -232,7 +227,7 @@ const checkIfOnUpdate = (element, parent, options) => {
232
227
  const contentKey = ref.contentElementKey;
233
228
  if (element.$collection || element.$stateCollection || element.$propsCollection) {
234
229
  element.removeContent();
235
- } else if ((_c = element[contentKey]) == null ? void 0 : _c.parseDeep)
230
+ } else if ((_b = element[contentKey]) == null ? void 0 : _b.parseDeep)
236
231
  element[contentKey] = element[contentKey].parseDeep();
237
232
  const previousElement = element.previousElement();
238
233
  const previousNode = previousElement == null ? void 0 : previousElement.node;
@@ -83,6 +83,8 @@ const create = async (element, parent2, key, options = OPTIONS.create || {}, att
83
83
  addChildrenIfNotInOriginal(element, parent2, key);
84
84
  const onInit = await triggerEventOn("init", element, options);
85
85
  if (onInit === false) return element;
86
+ const onEventInit = await triggerEventOn("eventInit", element, options);
87
+ if (onEventInit === false) return element;
86
88
  await triggerEventOn("beforeClassAssign", element, options);
87
89
  assignKeyAsClassname(element);
88
90
  await renderElement(element, parent2, options, attachOptions);
@@ -295,8 +297,10 @@ const createScope = (element, parent2) => {
295
297
  if (!element.scope) element.scope = parent2.scope || ref.root.scope || {};
296
298
  };
297
299
  const createIfConditionFlag = (element, parent2) => {
300
+ var _a;
298
301
  const { __ref: ref } = element;
299
- if (isFunction(element.if) && !element.if(element, element.state, element.context)) {
302
+ const ifFn = ((_a = element.props) == null ? void 0 : _a.if) || element.if;
303
+ if (isFunction(ifFn) && !ifFn(element, element.state, element.context)) {
300
304
  delete ref.__if;
301
305
  } else ref.__if = true;
302
306
  };
package/dist/esm/set.js CHANGED
@@ -60,12 +60,16 @@ const set = async function(params, options = {}, el) {
60
60
  return;
61
61
  }
62
62
  if (params) {
63
- let { childExtend, props } = params;
63
+ let { childExtend, childExtendRecursive, props } = params;
64
64
  if (!props) props = params.props = {};
65
65
  if (!childExtend && element.childExtend) {
66
66
  params.childExtend = element.childExtend;
67
67
  props.ignoreChildExtend = true;
68
68
  }
69
+ if (!childExtendRecursive && element.childExtendRecursive) {
70
+ params.childExtendRecursive = element.childExtendRecursive;
71
+ props.ignoreChildExtendRecursive = true;
72
+ }
69
73
  if (!(props == null ? void 0 : props.childProps) && ((_d = element.props) == null ? void 0 : _d.childProps)) {
70
74
  props.childProps = element.props.childProps;
71
75
  props.ignoreChildProps = true;
@@ -194,16 +194,11 @@ const captureSnapshot = (element, options) => {
194
194
  return [snapshotOnCallee, calleeElement];
195
195
  };
196
196
  const checkIfOnUpdate = (element, parent, options) => {
197
- var _a, _b, _c;
198
- if (!isFunction(element.if) && !isFunction((_a = element.props) == null ? void 0 : _a.if) || !parent)
199
- return;
197
+ var _a, _b;
198
+ const ifFn = ((_a = element.props) == null ? void 0 : _a.if) || element.if;
199
+ if (!isFunction(ifFn) || !parent) return;
200
200
  const ref = element.__ref;
201
- const ifPassed = (element.if || ((_b = element.props) == null ? void 0 : _b.if))(
202
- element,
203
- element.state,
204
- element.context,
205
- options
206
- );
201
+ const ifPassed = ifFn(element, element.state, element.context, options);
207
202
  const itWasFalse = ref.__if !== true;
208
203
  if (ifPassed) {
209
204
  ref.__if = true;
@@ -226,7 +221,7 @@ const checkIfOnUpdate = (element, parent, options) => {
226
221
  const contentKey = ref.contentElementKey;
227
222
  if (element.$collection || element.$stateCollection || element.$propsCollection) {
228
223
  element.removeContent();
229
- } else if ((_c = element[contentKey]) == null ? void 0 : _c.parseDeep)
224
+ } else if ((_b = element[contentKey]) == null ? void 0 : _b.parseDeep)
230
225
  element[contentKey] = element[contentKey].parseDeep();
231
226
  const previousElement = element.previousElement();
232
227
  const previousNode = previousElement == null ? void 0 : previousElement.node;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/element",
3
- "version": "2.33.26",
3
+ "version": "2.33.28",
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.33.26",
31
- "@domql/render": "^2.33.26",
32
- "@domql/state": "^2.33.26",
33
- "@domql/utils": "^2.33.26"
30
+ "@domql/event": "^2.33.28",
31
+ "@domql/render": "^2.33.28",
32
+ "@domql/state": "^2.33.28",
33
+ "@domql/utils": "^2.33.28"
34
34
  },
35
- "gitHead": "60d701cca225200ddb1e15d6a3a31da25dfc3bc0",
35
+ "gitHead": "58b2f9f34b228712ccc4352e15913c52d6007afb",
36
36
  "devDependencies": {
37
37
  "@babel/core": "^7.27.1"
38
38
  }
package/set.js CHANGED
@@ -88,12 +88,16 @@ export const set = async function (params, options = {}, el) {
88
88
  }
89
89
 
90
90
  if (params) {
91
- let { childExtend, props } = params
91
+ let { childExtend, childExtendRecursive, props } = params
92
92
  if (!props) props = params.props = {}
93
93
  if (!childExtend && element.childExtend) {
94
94
  params.childExtend = element.childExtend
95
95
  props.ignoreChildExtend = true
96
96
  }
97
+ if (!childExtendRecursive && element.childExtendRecursive) {
98
+ params.childExtendRecursive = element.childExtendRecursive
99
+ props.ignoreChildExtendRecursive = true
100
+ }
97
101
  if (!props?.childProps && element.props?.childProps) {
98
102
  props.childProps = element.props.childProps
99
103
  props.ignoreChildProps = true
package/update.js CHANGED
@@ -286,16 +286,11 @@ const captureSnapshot = (element, options) => {
286
286
  }
287
287
 
288
288
  const checkIfOnUpdate = (element, parent, options) => {
289
- if ((!isFunction(element.if) && !isFunction(element.props?.if)) || !parent)
290
- return
289
+ const ifFn = element.props?.if || element.if
290
+ if (!isFunction(ifFn) || !parent) return
291
291
 
292
292
  const ref = element.__ref
293
- const ifPassed = (element.if || element.props?.if)(
294
- element,
295
- element.state,
296
- element.context,
297
- options
298
- )
293
+ const ifPassed = ifFn(element, element.state, element.context, options)
299
294
  const itWasFalse = ref.__if !== true
300
295
 
301
296
  if (ifPassed) {