@almadar/core 10.10.0 → 10.12.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.
@@ -1,7 +1,7 @@
1
- import { T as TraitConfig, U as UISlot, E as Effect, a as Trait, R as RenderBinding, b as RenderUIEffect, c as TraitEventContract, d as Entity, e as TraitEventListener, C as CallSiteConfig, f as EntityField, g as EntityPersistence, h as EntityRow, i as TraitRef, j as TraitReference } from './trait-CKueAwP9.js';
2
- import { O as OrbitalSchema, U as UseDeclaration, E as EntityRef, P as PageRef, a as OrbitalDefinition, b as Page, c as PageRefObject } from './schema-C4ia6wFF.js';
1
+ import { T as TraitConfig, U as UISlot, E as Effect, a as Trait, R as RenderBinding, b as RenderUIEffect, c as TraitEventContract, d as Entity, e as TraitEventListener, C as CallSiteConfig, f as EntityField, g as EntityPersistence, h as EntityRow, i as TraitRef, j as TraitReference } from './trait-DecHZfpm.js';
2
+ import { O as OrbitalSchema, U as UseDeclaration, E as EntityRef, P as PageRef, a as OrbitalDefinition, b as Page, c as PageRefObject } from './schema-CSn8gU27.js';
3
3
  import { S as SExpr } from './expression-BUIi9ezJ.js';
4
- export { C as ComposeBehaviorsInput, a as ComposeBehaviorsResult, E as EventWiringEntry, L as LayoutStrategy, b as applyEventWiring, c as composeBehaviors, d as detectLayoutStrategy } from './compose-behaviors-CQCfFBnR.js';
4
+ export { C as ComposeBehaviorsInput, a as ComposeBehaviorsResult, E as EventWiringEntry, L as LayoutStrategy, b as applyEventWiring, c as composeBehaviors, d as detectLayoutStrategy } from './compose-behaviors-Bhf-XFFc.js';
5
5
  import { AnyPatternConfig } from '@almadar/patterns';
6
6
  import 'zod';
7
7
 
package/dist/builders.js CHANGED
@@ -344,6 +344,9 @@ var TraitConfigValueSchema = z.lazy(
344
344
  ])
345
345
  );
346
346
  var TraitConfigSchema = z.record(TraitConfigValueSchema);
347
+ function isCallSiteConfigDeclaration(entry) {
348
+ return typeof entry === "object" && entry !== null && !Array.isArray(entry) && "type" in entry && typeof entry.type === "string" && "default" in entry;
349
+ }
347
350
  var ConfigFieldDeclarationSchema = z.object({
348
351
  type: z.string(),
349
352
  default: TraitConfigValueSchema.optional(),
@@ -1192,18 +1195,25 @@ function overrideTrait(trait, values) {
1192
1195
  if ("scope" in trait) {
1193
1196
  const config = trait.config;
1194
1197
  if (config === void 0) return trait;
1195
- const next = { ...config };
1198
+ const next2 = { ...config };
1196
1199
  for (const [field, value] of Object.entries(values)) {
1197
1200
  const decl = config[field];
1198
1201
  if (decl !== void 0) {
1199
- next[field] = { ...decl, default: value };
1202
+ next2[field] = { ...decl, default: value };
1200
1203
  }
1201
1204
  }
1202
- return { ...trait, config: next };
1205
+ return { ...trait, config: next2 };
1203
1206
  }
1204
1207
  const base = trait.config !== void 0 ? { ...trait.config } : {};
1205
- const merged = { ...base, ...values };
1206
- return { ...trait, config: merged };
1208
+ const next = {};
1209
+ for (const [field, entry] of Object.entries(base)) {
1210
+ next[field] = isCallSiteConfigDeclaration(entry) ? entry : { type: "unknown", default: entry };
1211
+ }
1212
+ for (const [field, value] of Object.entries(values)) {
1213
+ const existing = base[field];
1214
+ next[field] = existing !== void 0 && isCallSiteConfigDeclaration(existing) ? { ...existing, default: value } : { type: "unknown", default: value };
1215
+ }
1216
+ return { ...trait, config: next };
1207
1217
  }
1208
1218
  function traitIdentity(trait) {
1209
1219
  if (trait.name !== void 0) return trait.name;