@yahoo/uds-create-config 5.54.0 → 5.55.0

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.
Files changed (45) hide show
  1. package/dist/capture/node-ops.js +1 -1
  2. package/dist/configs/system.js +2 -0
  3. package/dist/entities/canvas/node-gestures.js +1 -1
  4. package/dist/entities/canvas/node-patches.js +1 -1
  5. package/dist/entities/system/Component.d.ts +5 -2
  6. package/dist/entities/system/Component.js +121 -8
  7. package/dist/entities/system/LinkedSystem.js +2 -2
  8. package/dist/entities/system/Operation.js +1 -1
  9. package/dist/entities/system/component-forwards.js +1 -1
  10. package/dist/entities/system/component-source-fields.js +1 -1
  11. package/dist/entities/system/component-style-set.js +1 -1
  12. package/dist/entities/system/conditional-defaults.d.ts +45 -0
  13. package/dist/entities/system/conditional-defaults.js +142 -0
  14. package/dist/entities/system/copy-plan.js +1 -1
  15. package/dist/entities/system/css-motion-reach.js +1 -1
  16. package/dist/entities/system/defineComponent.d.ts +11 -2
  17. package/dist/entities/system/defineComponent.js +3 -0
  18. package/dist/entities/system/link-plan.js +1 -1
  19. package/dist/entities/system/motion-convert.js +1 -1
  20. package/dist/entities/system/motion-variants.js +2 -2
  21. package/dist/framework/Config.d.ts +1 -1
  22. package/dist/framework/Config.js +13 -4
  23. package/dist/framework/class-names.js +18 -6
  24. package/dist/framework/default-conditions.d.ts +26 -0
  25. package/dist/framework/default-conditions.js +35 -0
  26. package/dist/framework/defineEntity.js +1 -1
  27. package/dist/framework/inline-sources.js +1 -1
  28. package/dist/framework/layer-styles.js +7 -2
  29. package/dist/framework/plan.js +1 -1
  30. package/dist/framework/projections.js +18 -5
  31. package/dist/framework/render-spec.js +10 -2
  32. package/dist/framework/schema-version.d.ts +1 -1
  33. package/dist/framework/schema-version.js +5 -5
  34. package/dist/framework/schemas.js +2 -2
  35. package/dist/framework/source-integrity.js +1 -1
  36. package/dist/index.d.ts +4 -2
  37. package/dist/index.js +5 -3
  38. package/dist/migrations/20261023152030_conditional_defaults.d.ts +6 -0
  39. package/dist/migrations/20261023152030_conditional_defaults.js +8 -0
  40. package/dist/spec/bake.js +14 -6
  41. package/dist/spec/cell.d.ts +2 -1
  42. package/dist/spec/cell.js +14 -6
  43. package/dist/spec/detach.js +5 -1
  44. package/dist/tsconfig.tsbuildinfo +1 -1
  45. package/package.json +2 -2
@@ -39,7 +39,8 @@ declare class Cell {
39
39
  get defaults(): Record<string, unknown>;
40
40
  /** What the conditional `preview` entries that hold for this cell add, later entries over earlier. */
41
41
  get conditional(): Record<string, unknown>;
42
- /** The values in force: the defaults, what holds for the cell, then the coordinate itself. */
42
+ /** The values in force: the defaults, what holds for the cell, then the coordinate itself. The
43
+ * defaults are read under the coordinate, so a conditional default that holds for it applies. */
43
44
  get props(): Record<string, unknown>;
44
45
  /** The preview content the cell shows: the `*` entry, then every entry that holds for it. What a
45
46
  * drop seeds and a placed instance compares its own content against; no declared or code
package/dist/spec/cell.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { canonicalCondition, refLeaf } from "../framework/utils/refs.js";
2
+ import { storedDefaultConditions } from "../framework/default-conditions.js";
2
3
  import { createSliceMemo } from "../framework/memo.js";
3
4
  import { componentStates } from "../framework/component-states.js";
4
5
  import { unconditionalPreviewProps } from "../framework/preview-store.js";
@@ -57,13 +58,20 @@ var Cell = class {
57
58
  if (this.memoConditional === UNSET) this.memoConditional = previewConditionalProps(this.config, this.component, { ...this.coordinate });
58
59
  return this.memoConditional;
59
60
  }
60
- /** The values in force: the defaults, what holds for the cell, then the coordinate itself. */
61
+ /** The values in force: the defaults, what holds for the cell, then the coordinate itself. The
62
+ * defaults are read under the coordinate, so a conditional default that holds for it applies. */
61
63
  get props() {
62
- if (this.memoProps === UNSET) this.memoProps = {
63
- ...this.defaults,
64
- ...this.conditional,
65
- ...this.coordinate
66
- };
64
+ if (this.memoProps === UNSET) {
65
+ const conditional = Object.keys(storedDefaultConditions(this.config.resolve("component", this.component)?.body)).length > 0;
66
+ this.memoProps = conditional ? {
67
+ ...previewDefaults(this.config, this.component, { ...this.coordinate }),
68
+ ...this.coordinate
69
+ } : {
70
+ ...this.defaults,
71
+ ...this.conditional,
72
+ ...this.coordinate
73
+ };
74
+ }
67
75
  return this.memoProps;
68
76
  }
69
77
  /** The preview content the cell shows: the `*` entry, then every entry that holds for it. What a
@@ -1,4 +1,5 @@
1
1
  import { isRef, kindOf, pathOf, refLeaf } from "../framework/utils/refs.js";
2
+ import { defaultsFor } from "../framework/default-conditions.js";
2
3
  import { rootLayerOf } from "../entities/system/element.js";
3
4
  import { authoredValue, declaredPropDefaults } from "../framework/projections.js";
4
5
  import { forwardRoutes, isValueSlot } from "../framework/prop-surface.js";
@@ -106,7 +107,10 @@ function bakeInstance({ config, source, instanceProps, layerProps, filled }) {
106
107
  const sourceAnatomy = anatomyOf(sourceBody);
107
108
  const state = {
108
109
  ...declaredPropDefaults(sourceBody.props),
109
- ...sourceBody.defaultProps ?? {},
110
+ ...defaultsFor({
111
+ body: sourceBody,
112
+ given: instanceProps
113
+ }),
110
114
  ...instanceProps
111
115
  };
112
116
  for (const from of filled) if (state[from] === void 0) state[from] = true;