@yahoo/uds-create-config 5.56.2 → 5.56.3
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/dist/spec/bake.js +14 -5
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/spec/bake.js
CHANGED
|
@@ -270,15 +270,22 @@ function seedAt({ config, path, props }) {
|
|
|
270
270
|
const key = `${path}\u0000${JSON.stringify(cell.coordinate)}`;
|
|
271
271
|
const hit = byKey.get(key);
|
|
272
272
|
if (hit) return hit;
|
|
273
|
+
const body = config.resolve("component", path)?.body;
|
|
273
274
|
const own = {
|
|
274
275
|
...codeDefaults(config, path),
|
|
275
276
|
...defaultsFor({
|
|
276
|
-
body
|
|
277
|
+
body,
|
|
277
278
|
given: cell.props
|
|
278
279
|
})
|
|
279
280
|
};
|
|
281
|
+
const decls = body?.props;
|
|
280
282
|
const values = {};
|
|
281
|
-
for (const [prop, value] of Object.entries(cell.props)) if (!givesItself(
|
|
283
|
+
for (const [prop, value] of Object.entries(cell.props)) if (!givesItself({
|
|
284
|
+
own,
|
|
285
|
+
decls,
|
|
286
|
+
prop,
|
|
287
|
+
value
|
|
288
|
+
})) values[prop] = value;
|
|
282
289
|
const spec = graftPreviewElements(instanceSpec(path, values), values);
|
|
283
290
|
const root = spec.elements[spec.root];
|
|
284
291
|
const made = {
|
|
@@ -365,10 +372,12 @@ function graftSubtree({ source, from, into, root }) {
|
|
|
365
372
|
return remap;
|
|
366
373
|
}
|
|
367
374
|
/** Whether a component renders `value` for `prop` with nothing set: `own` is that value, or holds
|
|
368
|
-
* nothing for it and the value is
|
|
369
|
-
|
|
375
|
+
* nothing for it and the value is off for a boolean the component declares. A prop it doesn't
|
|
376
|
+
* declare is read by its render, whose default the config can't see, so a `false` there is kept. */
|
|
377
|
+
function givesItself({ own, decls, prop, value }) {
|
|
370
378
|
const given = own[prop];
|
|
371
|
-
|
|
379
|
+
if (given !== void 0) return stable(refLeaf(given)) === stable(refLeaf(value));
|
|
380
|
+
return value === false && decls?.[prop]?.type === "boolean";
|
|
372
381
|
}
|
|
373
382
|
const codeDefaultsByConfig = /* @__PURE__ */ new WeakMap();
|
|
374
383
|
/** What a component gives a prop by itself: its declared defaults under `defaultProps`. */
|