@yahoo/uds-create-config 5.56.0 → 5.56.1
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.
|
@@ -1990,6 +1990,22 @@ const componentBags = (data) => {
|
|
|
1990
1990
|
}, out);
|
|
1991
1991
|
return out;
|
|
1992
1992
|
};
|
|
1993
|
+
/** Conditional defaults with `names` gone: an entry conditioned on one is dropped, one setting one
|
|
1994
|
+
* loses that key, and an entry left setting nothing goes. */
|
|
1995
|
+
function withoutProps(conditions, names) {
|
|
1996
|
+
const out = {};
|
|
1997
|
+
for (const [key, entry] of Object.entries(conditions)) {
|
|
1998
|
+
const { when, props } = entry ?? {};
|
|
1999
|
+
if (when && names.some((name) => Object.hasOwn(when, name))) continue;
|
|
2000
|
+
const kept = Object.fromEntries(Object.entries(props ?? {}).filter(([name]) => !names.includes(name)));
|
|
2001
|
+
if (Object.keys(kept).length === 0) continue;
|
|
2002
|
+
out[key] = {
|
|
2003
|
+
...entry,
|
|
2004
|
+
props: kept
|
|
2005
|
+
};
|
|
2006
|
+
}
|
|
2007
|
+
return out;
|
|
2008
|
+
}
|
|
1993
2009
|
const ComponentEntity = defineEntity({
|
|
1994
2010
|
kind: "component",
|
|
1995
2011
|
rebaseLinkedBody: (args) => {
|
|
@@ -2000,6 +2016,8 @@ const ComponentEntity = defineEntity({
|
|
|
2000
2016
|
}) };
|
|
2001
2017
|
if (isRef(args.extend.file) && Object.hasOwn(args.extend, "anatomy")) delete body.anatomy;
|
|
2002
2018
|
if (!isPlainObject(body.props) || !isPlainObject(args.extend.props)) return body;
|
|
2019
|
+
const removed = Object.entries(args.extend.props).filter(([, declaration]) => declaration === null).map(([name]) => name);
|
|
2020
|
+
if (removed.length > 0 && isPlainObject(body.defaultPropsWhen)) body.defaultPropsWhen = withoutProps(body.defaultPropsWhen, removed);
|
|
2003
2021
|
const props = { ...body.props };
|
|
2004
2022
|
for (const [name, next] of Object.entries(args.extend.props)) {
|
|
2005
2023
|
const previous = props[name];
|