@domql/element 2.5.6 → 2.5.7

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
@@ -294,30 +294,45 @@ const onlyResolveExtends = (element, parent, key, options) => {
294
294
 
295
295
  if (!element.props) element.props = {}
296
296
 
297
- createState(element, parent, { skipApplyMethods: true, ...options })
297
+ createState(element, parent)
298
+
299
+ // Borrowed from createIfConditionFlag()
300
+ const ref = __ref
301
+ if (isFunction(element.if)) {
302
+ const ifPassed = element.if(element, element.state)
303
+ if (!ifPassed) {
304
+ // const ifFragment = cacheNode({ tag: 'fragment' })
305
+ // ref.__ifFragment = appendNode(ifFragment, parent.node)
306
+ delete ref.__if
307
+ } else ref.__if = true
308
+ } else ref.__if = true
309
+ //////
310
+
298
311
  createProps(element, parent)
299
312
  applyVariant(element, parent)
300
313
 
301
- throughInitialExec(element, options.propsExcludedFromExec)
302
-
303
- for (const param in element) {
304
- const prop = element[param]
305
- if (
306
- isUndefined(prop) ||
307
- isMethod(param) ||
308
- isObject(registry[param]) ||
309
- isVariant(param)
310
- ) continue
311
-
312
- const hasDefine = element.define && element.define[param]
313
- const contextHasDefine = element.context && element.context.define &&
314
- element.context.define[param]
315
- const optionsHasDefine = options.define && options.define[param]
316
-
317
- if (registry[param] && !optionsHasDefine) {
318
- continue
319
- } else if (element[param] && !hasDefine && !optionsHasDefine && !contextHasDefine) {
320
- create(exec(prop, element), element, param, options)
314
+ if (element.tag !== 'string' || element.tag !== 'fragment') {
315
+ throughInitialExec(element, options.propsExcludedFromExec)
316
+
317
+ for (const param in element) {
318
+ const prop = element[param]
319
+ if (
320
+ isUndefined(prop) ||
321
+ isMethod(param) ||
322
+ isObject(registry[param]) ||
323
+ isVariant(param)
324
+ ) continue
325
+
326
+ const hasDefine = element.define && element.define[param]
327
+ const contextHasDefine = element.context && element.context.define &&
328
+ element.context.define[param]
329
+ const optionsHasDefine = options.define && options.define[param]
330
+
331
+ if (registry[param] && !optionsHasDefine) {
332
+ continue
333
+ } else if (element[param] && !hasDefine && !optionsHasDefine && !contextHasDefine) {
334
+ create(exec(prop, element), element, param, options)
335
+ }
321
336
  }
322
337
  }
323
338
 
@@ -234,21 +234,32 @@ const onlyResolveExtends = (element, parent, key, options) => {
234
234
  __ref.__attr = {};
235
235
  if (!element.props)
236
236
  element.props = {};
237
- (0, import_state.createState)(element, parent, { skipApplyMethods: true, ...options });
237
+ (0, import_state.createState)(element, parent);
238
+ const ref = __ref;
239
+ if ((0, import_utils.isFunction)(element.if)) {
240
+ const ifPassed = element.if(element, element.state);
241
+ if (!ifPassed) {
242
+ delete ref.__if;
243
+ } else
244
+ ref.__if = true;
245
+ } else
246
+ ref.__if = true;
238
247
  (0, import_props.createProps)(element, parent);
239
248
  (0, import_component.applyVariant)(element, parent);
240
- (0, import_iterate.throughInitialExec)(element, options.propsExcludedFromExec);
241
- for (const param in element) {
242
- const prop = element[param];
243
- if ((0, import_utils.isUndefined)(prop) || (0, import_methods.isMethod)(param) || (0, import_utils.isObject)(import_mixins.registry[param]) || (0, import_component.isVariant)(param))
244
- continue;
245
- const hasDefine = element.define && element.define[param];
246
- const contextHasDefine = element.context && element.context.define && element.context.define[param];
247
- const optionsHasDefine = options.define && options.define[param];
248
- if (import_mixins.registry[param] && !optionsHasDefine) {
249
- continue;
250
- } else if (element[param] && !hasDefine && !optionsHasDefine && !contextHasDefine) {
251
- create((0, import_utils.exec)(prop, element), element, param, options);
249
+ if (element.tag !== "string" || element.tag !== "fragment") {
250
+ (0, import_iterate.throughInitialExec)(element, options.propsExcludedFromExec);
251
+ for (const param in element) {
252
+ const prop = element[param];
253
+ if ((0, import_utils.isUndefined)(prop) || (0, import_methods.isMethod)(param) || (0, import_utils.isObject)(import_mixins.registry[param]) || (0, import_component.isVariant)(param))
254
+ continue;
255
+ const hasDefine = element.define && element.define[param];
256
+ const contextHasDefine = element.context && element.context.define && element.context.define[param];
257
+ const optionsHasDefine = options.define && options.define[param];
258
+ if (import_mixins.registry[param] && !optionsHasDefine) {
259
+ continue;
260
+ } else if (element[param] && !hasDefine && !optionsHasDefine && !contextHasDefine) {
261
+ create((0, import_utils.exec)(prop, element), element, param, options);
262
+ }
252
263
  }
253
264
  }
254
265
  parent[key || element.key] = element;
@@ -40,6 +40,7 @@ var registry_default = {
40
40
  if: {},
41
41
  define: {},
42
42
  transform: {},
43
+ __name: {},
43
44
  __ref: {},
44
45
  __hash: {},
45
46
  __text: {},
@@ -24,6 +24,7 @@ export default {
24
24
  if: {},
25
25
  define: {},
26
26
  transform: {},
27
+ __name: {},
27
28
  __ref: {},
28
29
  __hash: {},
29
30
  __text: {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domql/element",
3
- "version": "2.5.6",
3
+ "version": "2.5.7",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "index.js",
@@ -31,7 +31,7 @@
31
31
  "@domql/state": "latest",
32
32
  "@domql/utils": "latest"
33
33
  },
34
- "gitHead": "e05c05cdecb20e2b9e4d9ea728bb2707cb27912c",
34
+ "gitHead": "fe6520d996b2ca837f6965928a51360ea91e9695",
35
35
  "devDependencies": {
36
36
  "@babel/core": "^7.12.0"
37
37
  }