@domql/utils
Advanced tools
Comparing version 2.5.152 to 2.5.153
@@ -37,3 +37,3 @@ 'use strict' | ||
const checkIfSugar = (element, parent, key) => { | ||
export const checkIfSugar = (element, parent, key) => { | ||
const { | ||
@@ -44,3 +44,3 @@ extend, | ||
extends: extendProps, | ||
childrenExtends, | ||
childExtends, | ||
childProps, | ||
@@ -54,6 +54,7 @@ children, | ||
const hasComponentAttrs = extend || childExtend || props || on || $collection || $stateCollection || $propsCollection | ||
if (hasComponentAttrs && (childProps || extendProps || children || childrenExtends)) { | ||
parent.error('Sugar component includes params for builtin components', { verbose: true }) | ||
if (hasComponentAttrs && (childProps || extendProps || children || childExtends)) { | ||
const logErr = (parent || element)?.error | ||
if (logErr) logErr('Sugar component includes params for builtin components', { verbose: true }) | ||
} | ||
return !hasComponentAttrs || childProps || extendProps || children || childrenExtends | ||
return !hasComponentAttrs || childProps || extendProps || children || childExtends | ||
} | ||
@@ -63,3 +64,3 @@ | ||
const { context } = parent | ||
const { tag, extend, childrenExtends } = element | ||
const { tag, extend, childExtends } = element | ||
const isSugar = checkIfSugar(element, parent, key) | ||
@@ -83,3 +84,3 @@ | ||
}) | ||
if (childrenExtends) newElem.childExtend = childrenExtends | ||
if (childExtends) newElem.childExtend = childExtends | ||
return newElem | ||
@@ -103,3 +104,3 @@ } else if (!extend || extend === true) { | ||
function getCapitalCaseKeys (obj) { | ||
export function getCapitalCaseKeys (obj) { | ||
return Object.keys(obj).filter(key => /^[A-Z]/.test(key)) | ||
@@ -123,6 +124,4 @@ } | ||
if (newChild?.ignoreExtend) continue | ||
if (newChild === null && childElem) { | ||
console.log('is null', element) | ||
assignChild(null) | ||
} else if (!childElem) assignChild(deepCloneWithExtend(newChild)) | ||
if (newChild === null) assignChild(null) | ||
else if (!childElem) assignChild(deepCloneWithExtend(newChild)) | ||
else { | ||
@@ -129,0 +128,0 @@ const isSugarChildElem = checkIfSugar(childElem, parent, key) |
@@ -27,3 +27,5 @@ "use strict"; | ||
checkIfKeyIsProperty: () => checkIfKeyIsProperty, | ||
checkIfSugar: () => checkIfSugar, | ||
extendizeByKey: () => extendizeByKey, | ||
getCapitalCaseKeys: () => getCapitalCaseKeys, | ||
getChildrenComponentsByKey: () => getChildrenComponentsByKey, | ||
@@ -62,2 +64,3 @@ getExtendsInElement: () => getExtendsInElement, | ||
const checkIfSugar = (element, parent, key) => { | ||
var _a; | ||
const { | ||
@@ -68,3 +71,3 @@ extend, | ||
extends: extendProps, | ||
childrenExtends, | ||
childExtends, | ||
childProps, | ||
@@ -78,10 +81,12 @@ children, | ||
const hasComponentAttrs = extend || childExtend || props || on || $collection || $stateCollection || $propsCollection; | ||
if (hasComponentAttrs && (childProps || extendProps || children || childrenExtends)) { | ||
parent.error("Sugar component includes params for builtin components", { verbose: true }); | ||
if (hasComponentAttrs && (childProps || extendProps || children || childExtends)) { | ||
const logErr = (_a = parent || element) == null ? void 0 : _a.error; | ||
if (logErr) | ||
logErr("Sugar component includes params for builtin components", { verbose: true }); | ||
} | ||
return !hasComponentAttrs || childProps || extendProps || children || childrenExtends; | ||
return !hasComponentAttrs || childProps || extendProps || children || childExtends; | ||
}; | ||
const extendizeByKey = (element, parent, key) => { | ||
const { context } = parent; | ||
const { tag, extend, childrenExtends } = element; | ||
const { tag, extend, childExtends } = element; | ||
const isSugar = checkIfSugar(element, parent, key); | ||
@@ -98,4 +103,4 @@ const extendFromKey = key.includes("+") ? key.split("+") : key.includes("_") ? [key.split("_")[0]] : key.includes(".") && !checkIfKeyIsComponent(key.split(".")[1]) ? [key.split(".")[0]] : [key]; | ||
}); | ||
if (childrenExtends) | ||
newElem.childExtend = childrenExtends; | ||
if (childExtends) | ||
newElem.childExtend = childExtends; | ||
return newElem; | ||
@@ -135,6 +140,5 @@ } else if (!extend || extend === true) { | ||
continue; | ||
if (newChild === null && childElem) { | ||
console.log("is null", element); | ||
if (newChild === null) | ||
assignChild(null); | ||
} else if (!childElem) | ||
else if (!childElem) | ||
assignChild((0, import__.deepCloneWithExtend)(newChild)); | ||
@@ -141,0 +145,0 @@ else { |
{ | ||
"name": "@domql/utils", | ||
"version": "2.5.152", | ||
"version": "2.5.153", | ||
"license": "MIT", | ||
@@ -28,3 +28,3 @@ "type": "module", | ||
}, | ||
"gitHead": "249d2545f3ee35b450ca90d399fc7c3e54a4a7bc", | ||
"gitHead": "ebf5debf658fdae4ec5a99b541b2518c7767e6a8", | ||
"devDependencies": { | ||
@@ -31,0 +31,0 @@ "@babel/core": "^7.12.0" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
112123
3378