@almadar/core 10.77.0 → 10.79.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,6 +1,6 @@
1
- import { I as IdentityLedger, A as AnyPatternConfig, U as UISlot, c as Effect, h as RenderBinding, i as RenderUIEffect, d as EntityId, e as Entity, E as EntityField, a as EntityPersistence, f as EntityRow } from './effect-BHaHSAvM.js';
2
- import { a as OrbitalDefinition, O as OrbitalSchema, U as UseDeclaration, E as EntityRef, b as ExpectDeclaration, P as PageRef, c as Page, d as PageRefObject } from './schema-Czlrw3bA.js';
3
- import { b as TraitConfig, g as Trait, T as TraitEventListener, h as CallSiteConfig, j as TraitEventContract, d as TraitRef, a as TraitReference } from './trait-DCmf5iRN.js';
1
+ import { I as IdentityLedger, A as AnyPatternConfig, U as UISlot, c as Effect, h as RenderBinding, i as RenderUIEffect, d as EntityId, e as Entity, E as EntityField, a as EntityPersistence, f as EntityRow } from './effect-Mx_niZdY.js';
2
+ import { a as OrbitalDefinition, O as OrbitalSchema, U as UseDeclaration, E as EntityRef, b as ExpectDeclaration, P as PageRef, c as Page, d as PageRefObject } from './schema-CkTuSx6F.js';
3
+ import { b as TraitConfig, h as Trait, T as TraitEventListener, i as CallSiteConfig, k as TraitEventContract, d as TraitRef, a as TraitReference } from './trait-B1fI0lTU.js';
4
4
  import { S as SExpr } from './expression-Fk8bQWef.js';
5
5
  import 'zod';
6
6
 
@@ -356,6 +356,11 @@ interface MakeTraitRefOpts {
356
356
  linkedEntityId?: EntityId;
357
357
  /** Per-key rename map, e.g. `{ OPEN: "ADD_ITEM" }`. */
358
358
  events?: Record<string, string>;
359
+ /**
360
+ * 3-II trait type-parameter arguments (`:: p SomeType`): declared-param
361
+ * name → type-vocabulary name. Mirrors {@link TraitReference.typeArgs}.
362
+ */
363
+ typeArgs?: Record<string, string>;
359
364
  /**
360
365
  * Entity-field remap, e.g. `{ name: "title", folder: "parentId" }`. Rewrites
361
366
  * the inlined trait's canonical `@entity.X` / `@payload.row.X` references to
package/dist/builders.js CHANGED
@@ -102,7 +102,9 @@ var FIELD_TYPES = [
102
102
  "slot",
103
103
  "pattern",
104
104
  "node",
105
- "event"
105
+ "event",
106
+ "scalar",
107
+ "union"
106
108
  ];
107
109
  z.enum(FIELD_TYPES);
108
110
  var RelationCardinalitySchema = z.enum([
@@ -198,12 +200,20 @@ var EntityFieldSchema = z.lazy(() => {
198
200
  scalarVariant("event"),
199
201
  scalarVariant("money"),
200
202
  scalarVariant("file"),
203
+ scalarVariant("scalar"),
201
204
  // Enum variant — REQUIRES non-empty values.
202
205
  z.object({
203
206
  ...baseFieldShape,
204
207
  type: z.literal("enum"),
205
208
  values: z.array(z.string()).min(1, "Enum field requires a non-empty `values` array")
206
209
  }),
210
+ // Union variant — tagged struct union; values = variant names,
211
+ // per-variant shapes in `properties` (absent on named recursion).
212
+ z.object({
213
+ ...baseFieldShape,
214
+ type: z.literal("union"),
215
+ values: z.array(z.string()).min(1, "Union field requires a non-empty `values` array")
216
+ }),
207
217
  // Relation variant — REQUIRES relation config.
208
218
  z.object({
209
219
  ...baseFieldShape,
@@ -246,8 +256,8 @@ var ASSET_DIMENSIONS = ["2d", "3d"];
246
256
  var AssetDimensionSchema = z.enum(ASSET_DIMENSIONS);
247
257
  var ASSET_ASPECTS = ["1:1", "16:9", "5:7", "8:1"];
248
258
  var AssetAspectSchema = z.enum(ASSET_ASPECTS);
249
- var ANIMATION_NAMES = ["idle", "walk", "attack", "hit", "death"];
250
- var AnimationNameSchema = z.enum(ANIMATION_NAMES);
259
+ var ANIMATION_NAMES = ["idle", "walk", "skate", "jump", "fall", "attack", "hit", "death"];
260
+ z.enum(ANIMATION_NAMES);
251
261
  var SPRITE_DIRECTIONS = ["se", "sw", "ne", "nw"];
252
262
  var SpriteDirectionSchema = z.enum(SPRITE_DIRECTIONS);
253
263
  var SHEET_PROJECTIONS = ["iso", "front", "back", "top", "perspective"];
@@ -267,7 +277,7 @@ z.object({
267
277
  rows: z.number().int().positive(),
268
278
  directions: z.array(SpriteDirectionSchema),
269
279
  sheets: z.record(SpriteDirectionSchema, z.string()),
270
- animations: z.record(AnimationNameSchema, AnimationDefSchema),
280
+ animations: z.record(z.string(), AnimationDefSchema),
271
281
  projections: z.object({
272
282
  iso: z.record(SpriteDirectionSchema, z.string()).optional(),
273
283
  front: z.string().optional(),
@@ -642,6 +652,8 @@ var TraitEventContractSchema = z.object({
642
652
  description: z.string().optional(),
643
653
  synonyms: z.string().optional(),
644
654
  tier: z.string().optional(),
655
+ definerKnob: z.string().optional(),
656
+ scopeOverridden: z.boolean().optional(),
645
657
  payloadSchema: z.array(EventPayloadFieldSchema).optional(),
646
658
  scope: EventScopeSchema.optional()
647
659
  });
@@ -695,6 +707,11 @@ var TraitReferenceSchema = z.object({
695
707
  z.string().min(1, "events value (caller event name) must be non-empty")
696
708
  ).optional(),
697
709
  eventIds: z.record(z.string().min(1), EventIdSchema).optional(),
710
+ // 3-II type-parameter arguments (see `TraitReference.typeArgs`).
711
+ typeArgs: z.record(
712
+ z.string().min(1, "typeArgs key (declared param name) must be non-empty"),
713
+ z.string().min(1, "typeArgs value (type name) must be non-empty")
714
+ ).optional(),
698
715
  fields: z.record(
699
716
  z.string().min(1, "fields key (canonical field name) must be non-empty"),
700
717
  z.string().min(1, "fields value (consumer field name) must be non-empty")
@@ -755,6 +772,11 @@ var SourceBehaviorMetadataSchema = z.object({
755
772
  alias: z.string().min(1),
756
773
  originalName: z.string().min(1)
757
774
  });
775
+ var TraitTypeParamDefSchema = z.object({
776
+ name: z.string().min(1),
777
+ kind: z.string().min(1),
778
+ default: z.string().optional()
779
+ });
758
780
  var TraitSchema = z.object({
759
781
  id: TraitIdSchema.optional(),
760
782
  name: z.string().min(1),
@@ -781,7 +803,8 @@ var TraitSchema = z.object({
781
803
  ui: TraitUIBindingSchema.optional(),
782
804
  config: DeclaredTraitConfigSchema.optional(),
783
805
  sourceBehavior: SourceBehaviorMetadataSchema.optional(),
784
- sourceEntityDefinition: EntitySchema.optional()
806
+ sourceEntityDefinition: EntitySchema.optional(),
807
+ typeParams: z.array(TraitTypeParamDefSchema).optional()
785
808
  });
786
809
  var TraitRefSchema = z.union([
787
810
  z.string().min(1),
@@ -1436,7 +1459,8 @@ z.object({
1436
1459
  // Context fields - persisted throughout orbital lifecycle
1437
1460
  domainContext: DomainContextSchema.optional(),
1438
1461
  design: DesignPreferencesSchema.optional(),
1439
- suggestedGuards: z.array(SuggestedGuardSchema).optional()
1462
+ suggestedGuards: z.array(SuggestedGuardSchema).optional(),
1463
+ types: z.record(z.string(), z.array(EventPayloadFieldSchema)).optional()
1440
1464
  });
1441
1465
 
1442
1466
  // src/builders/apply-config-overrides.ts
@@ -1849,6 +1873,7 @@ function makeTraitRef(opts) {
1849
1873
  if (opts.linkedEntity !== void 0) ref.linkedEntity = opts.linkedEntity;
1850
1874
  if (opts.linkedEntityId !== void 0) ref.linkedEntityId = opts.linkedEntityId;
1851
1875
  if (opts.events !== void 0) ref.events = opts.events;
1876
+ if (opts.typeArgs !== void 0) ref.typeArgs = opts.typeArgs;
1852
1877
  if (opts.fields !== void 0) ref.fields = opts.fields;
1853
1878
  if (opts.effects !== void 0) ref.effects = opts.effects;
1854
1879
  if (opts.listens !== void 0) ref.listens = opts.listens;