@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 +36 -21
- package/dist/cjs/create.js +24 -13
- package/dist/cjs/mixins/registry.js +1 -0
- package/mixins/registry.js +1 -0
- package/package.json +2 -2
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
|
|
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
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
const
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
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
|
|
package/dist/cjs/create.js
CHANGED
|
@@ -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
|
|
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
|
-
|
|
241
|
-
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
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;
|
package/mixins/registry.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/element",
|
|
3
|
-
"version": "2.5.
|
|
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": "
|
|
34
|
+
"gitHead": "fe6520d996b2ca837f6965928a51360ea91e9695",
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@babel/core": "^7.12.0"
|
|
37
37
|
}
|