@almadar/core 10.8.0 → 10.10.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.
- package/dist/builders.d.ts +14 -7
- package/dist/builders.js +7 -2
- package/dist/builders.js.map +1 -1
- package/dist/{compose-behaviors-9xDCK9IA.d.ts → compose-behaviors-CQCfFBnR.d.ts} +1 -1
- package/dist/factory/index.d.ts +3 -3
- package/dist/factory/index.js +63 -0
- package/dist/factory/index.js.map +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.js +72 -2
- package/dist/index.js.map +1 -1
- package/dist/{schema-C3osccoR.d.ts → schema-C4ia6wFF.d.ts} +25 -25
- package/dist/{trait-DwxDJ6PP.d.ts → trait-CKueAwP9.d.ts} +45 -14
- package/dist/types/index.d.ts +6 -6
- package/dist/types/index.js +9 -2
- package/dist/types/index.js.map +1 -1
- package/dist/{types-zx68_GSb.d.ts → types-DzmFPbo4.d.ts} +5 -1
- package/package.json +1 -1
package/dist/builders.d.ts
CHANGED
|
@@ -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-
|
|
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-
|
|
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';
|
|
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-
|
|
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';
|
|
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
|
-
/**
|
|
248
|
-
|
|
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
|
|
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?:
|
|
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
|
-
|
|
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
|
-
|
|
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;
|