@almadar/core 10.7.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.
- package/dist/builders.d.ts +14 -7
- package/dist/builders.js +12 -2
- package/dist/builders.js.map +1 -1
- package/dist/{compose-behaviors-B96ChDbl.d.ts → compose-behaviors-CNTCOsui.d.ts} +1 -1
- package/dist/factory/index.d.ts +3 -3
- package/dist/factory/index.js +57 -0
- package/dist/factory/index.js.map +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.js +71 -2
- package/dist/index.js.map +1 -1
- package/dist/{schema-QKCaijbj.d.ts → schema-DAc5czBW.d.ts} +25 -25
- package/dist/{trait-BkW6nFHo.d.ts → trait-CWjT0yBO.d.ts} +96 -14
- package/dist/types/index.d.ts +6 -6
- package/dist/types/index.js +14 -2
- package/dist/types/index.js.map +1 -1
- package/dist/{types-R0vBMx1v.d.ts → types-CQvAbsEc.d.ts} +1 -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-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-
|
|
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
|
-
/**
|
|
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
|
@@ -177,6 +177,11 @@ var SemanticAssetRefSchema = z.object({
|
|
|
177
177
|
dimension: AssetDimensionSchema.optional(),
|
|
178
178
|
aspect: AssetAspectSchema.optional()
|
|
179
179
|
});
|
|
180
|
+
SemanticAssetRefSchema.extend({
|
|
181
|
+
url: z.string(),
|
|
182
|
+
name: z.string().optional(),
|
|
183
|
+
thumbnailUrl: z.string().optional()
|
|
184
|
+
});
|
|
180
185
|
z.object({
|
|
181
186
|
basePath: z.string(),
|
|
182
187
|
path: z.string(),
|
|
@@ -481,7 +486,11 @@ z.object({
|
|
|
481
486
|
z.string().min(1, "fields key (canonical field name) must be non-empty"),
|
|
482
487
|
z.string().min(1, "fields value (consumer field name) must be non-empty")
|
|
483
488
|
).optional(),
|
|
484
|
-
|
|
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(),
|
|
485
494
|
appliesTo: z.array(z.string()).optional(),
|
|
486
495
|
// Phase F.7: zod accepts an array (the inliner validates element
|
|
487
496
|
// shape). The full ListenDefinition shape isn't recursively encoded
|
|
@@ -1193,7 +1202,8 @@ function overrideTrait(trait, values) {
|
|
|
1193
1202
|
return { ...trait, config: next };
|
|
1194
1203
|
}
|
|
1195
1204
|
const base = trait.config !== void 0 ? { ...trait.config } : {};
|
|
1196
|
-
|
|
1205
|
+
const merged = { ...base, ...values };
|
|
1206
|
+
return { ...trait, config: merged };
|
|
1197
1207
|
}
|
|
1198
1208
|
function traitIdentity(trait) {
|
|
1199
1209
|
if (trait.name !== void 0) return trait.name;
|