@almadar/core 10.8.0 → 10.9.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, f as EntityField, g as EntityPersistence, h as EntityRow, i as TraitRef, j as TraitReference } from './trait-DwxDJ6PP.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-C3osccoR.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-CWjT0yBO.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-DAc5czBW.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-9xDCK9IA.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-CNTCOsui.js';
5
5
  import { AnyPatternConfig } from '@almadar/patterns';
6
6
  import 'zod';
7
7
 
@@ -244,8 +244,12 @@ interface MakeTraitRefOpts {
244
244
  listens?: TraitEventListener[];
245
245
  /** Set every emit's scope. */
246
246
  emitsScope?: 'internal' | 'external';
247
- /** Call-site config overrides. Matches {@link TraitReference.config}. */
248
- config?: TraitConfig;
247
+ /**
248
+ * Call-site config overrides. Each entry is either a plain wiring value
249
+ * (`TraitConfigValue`) or a fully-annotated re-declaration
250
+ * (`ConfigFieldDeclaration`). Matches {@link TraitReference.config}.
251
+ */
252
+ config?: CallSiteConfig;
249
253
  }
250
254
  /**
251
255
  * Typed-narrowing variant of {@link MakeTraitRefOpts} for callers that know
@@ -260,6 +264,9 @@ interface MakeTraitRefOpts {
260
264
  * `events` rename map's keys to legal originals only.
261
265
  * - `ConfigShape` — typed shape of the trait's `config { ... }` block (literal
262
266
  * unions intact). Narrows the `config` override to the atom's actual fields.
267
+ * Extends `CallSiteConfig` to allow both plain wiring values and annotated
268
+ * declarations. Existing callers using plain `TraitConfig` shapes are
269
+ * unaffected (TraitConfig ⊆ CallSiteConfig).
263
270
  * - `ListenKey` — string union of the atom's listen-key contract. Narrows
264
271
  * each listens entry's `event` against the atom's real subscription set.
265
272
  *
@@ -267,7 +274,7 @@ interface MakeTraitRefOpts {
267
274
  * narrow and wide forms via the standard structural-typing rules. This is
268
275
  * a type-level narrowing only; widening at the call boundary is intentional.
269
276
  */
270
- interface MakeTraitRefOptsTyped<EventKey extends string = string, ConfigShape extends TraitConfig = Record<string, never>, ListenKey extends string = string> extends Omit<MakeTraitRefOpts, 'events' | 'effects' | 'listens' | 'config'> {
277
+ interface MakeTraitRefOptsTyped<EventKey extends string = string, ConfigShape extends CallSiteConfig = Record<string, never>, ListenKey extends string = string> extends Omit<MakeTraitRefOpts, 'events' | 'effects' | 'listens' | 'config'> {
271
278
  /** Per-key rename map, narrowed to the atom's actual event keys. */
272
279
  events?: Partial<Record<EventKey, string>>;
273
280
  /**
@@ -372,7 +379,7 @@ interface MakeAtomOrbitalTraitOverrides {
372
379
  effects?: Record<string, SExpr[]>;
373
380
  listens?: TraitEventListener[];
374
381
  emitsScope?: 'internal' | 'external';
375
- config?: TraitConfig;
382
+ config?: CallSiteConfig;
376
383
  }
377
384
  /**
378
385
  * Options for {@link makeAtomOrbital}.
package/dist/builders.js CHANGED
@@ -486,7 +486,11 @@ z.object({
486
486
  z.string().min(1, "fields key (canonical field name) must be non-empty"),
487
487
  z.string().min(1, "fields value (consumer field name) must be non-empty")
488
488
  ).optional(),
489
- config: TraitConfigSchema.optional(),
489
+ // Each value is either a plain wiring value (TraitConfigValue) or an
490
+ // annotated ConfigFieldDeclaration. Declaration form is tried first
491
+ // (it's more specific — has a `"type"` string key); plain values fall
492
+ // through to the recursive TraitConfigValue union.
493
+ config: z.record(z.union([ConfigFieldDeclarationSchema, TraitConfigValueSchema])).optional(),
490
494
  appliesTo: z.array(z.string()).optional(),
491
495
  // Phase F.7: zod accepts an array (the inliner validates element
492
496
  // shape). The full ListenDefinition shape isn't recursively encoded
@@ -1198,7 +1202,8 @@ function overrideTrait(trait, values) {
1198
1202
  return { ...trait, config: next };
1199
1203
  }
1200
1204
  const base = trait.config !== void 0 ? { ...trait.config } : {};
1201
- return { ...trait, config: { ...base, ...values } };
1205
+ const merged = { ...base, ...values };
1206
+ return { ...trait, config: merged };
1202
1207
  }
1203
1208
  function traitIdentity(trait) {
1204
1209
  if (trait.name !== void 0) return trait.name;